Here are my two submissions https://codeforces.com/contest/1484/submission/110870622 when i change ceil(m/2) with (m+1)/2 it got AC https://codeforces.com/contest/1484/submission/110882130 But i think ceil(m/2) and (m+1)/2 give same result... I can not figure out the reason.. Can anyone help? Any help would be highly appreciated... Thank You.
Ceil(m/2) If m is integer then the compiler will first do Integer division of m/2. Then will do the ceil operation. So, if m=3 then m/2 = 1 and ceil(1)=1. You can do ceil(m/2.0) instead.
ceil function is not so good for precision, also m / 2 returns integer as m is an integer
Any number like ceil(m/a)=(m+a-1)/a;