Only half of the solution is correct

http://www.codechef.com/viewsolution/5895057

Only subtask 1 is completely solved. Whats the problem for subtask 2?
please somebody help.

here is the question attached http://www.codechef.com/problems/CHEFSTON/

The limits in subtask 2 demand that the result variable be of a time that can contain values greater than 10^10, therefore you will need to define the variable ‘sum’ as long long int.
(Long int and Int are similar for the codechef compiler imo)

Hello majauee11,

I looked at your submissions and i find that you are not using appropriate data types which are required to save or maintain the results.

Look at this submission … I tried to code it similiar to your code which just some data types changed.

I also put comments so that you can understand it better.

http://www.codechef.com/viewsolution/5896966

I also recommend you to go through this … so that you can choose the suitable data type depending upon the requirement…

http://msdn.microsoft.com/en-IN/library/s3f49ktz.aspx

This link helped me alot … hope it will also help you :smiley:

1 Like