ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1430. Crime and Punishment

WA 16, or how I lost 13 tries
Posted by [RISE] Levon Oganesyan [RAU] 20 Jul 2014 11:04
Hi all.

I tried to solve this problem with standart method. I devide all numbers on GCD, and calculate all x in A*x + B*y and I tried find the maximum T, T <= N.

In cicle I write something like this:
if ( max < T )
{
   max = T;
   //something too
}
and have WA16.
After WA16 I tried fix my program, but don't find anything global. Fix something right on wrong, I 13 times get WA 1 - 16.

Then I changed ( max < T ) on ( max <= T ), and don't send, because did not think, what that will be changed WA16 on AC. I was wrong.

I don't know why that fix is right, can someone explain me?

Thanks. Sorry for bad English.
Re: WA 16, or how I lost 13 tries
Test 2 2 1
Re: WA 16, or how I lost 13 tries
Posted by [RISE] Levon Oganesyan [RAU] 20 Jul 2014 20:50
Ouch... Thanks, I understood my problem.
I am write
int q, w;
instead of
int q = 0, w = 0;