can you please tell me what is wrong in my code

Can anyone help me what is wrong with my code
question line -
https://www.codechef.com/START30B/problems/GFTSHP
my submission link -
https://www.codechef.com/viewsolution/60649808

please help me asap…

Hey, the problem in your code is that you have applied ceil on (a[i]/2), which is an integer, so basically what is happening is that first the division occurs and it returns the integers value(removing everything after the decimal), and then the rounded value is being passed to ceil.

Instead if you typecast the values to double or long double before dividing, it will work.

Look at the code here, I have added long double before a[i] and it passed :slight_smile:

1 Like

oh! thanks …now i got my mistake