LOGIC1 Problem:
For this problem, I thought strategy of binary search would work. By every one experiment we can eliminate half of the possiblities and ceil(log(n))+1 would be the answer. I was getting wrong answer.
After completion of contest, when I saw others’ code, I found that most of people were using following strategy:
-
ans = sqrt(2n)
-
if(ans * (ans + 1) < n )
ans++;
Can somebody tell me how it works ?
LOGIC2 Problem:
For this problem, I figured out strategy in last 2 minutes. Due to lack of time I could not code the solution. But if i have coded it it could have got WA. Strategy I was thinking was that
Get prime factorization of numbers. If number of prime number is even then CODY will even, otherwise ZACH will win.
Can somebody tell me what is wrong with this?