Help in Atcoder problem

This is B problem from Atcoder beginner contest 161. I wrote this code initially but 2 out of 16 test-cases gave me WA. Then I changed threshold variable from ceil into floor but still 2 test cases gave me WA then I changed threshold into double(no-ceil and no-floor) instead of int but still I’m getting WA in 1 test case. I tried using even ceil and floor with double but still getting stuck.

Can anyone help what test case I’m missing, where am I wrong?

You forgot to type cast, otherwise division will be floor division.

ll int threshold = ceil((long double)totalNoOfVotes/(4*m));

1 Like

Ohhh! Thank you. I got it.