Page 1 of 1

10787 - Modular Equations

Posted: Thu Dec 09, 2004 7:57 pm
by hackfox
From the accept ratio, it seems this problem is easy.
But unfortunately, I still get Wrong Answer after several attempts.

Could someone provide some corner cases that we often ignore?

Besides, I have some assumptions, but don't know if it's always true.

1.About the input, assume the 3 pairs of numer is a0,a1,b0,b1,m0,m1,
can we assume that a0<= a1 and b0<=b1 and m0<=m1?
2.I guess a plays as a constant value, in other words, the answer is
always a multiplier of (amax-amin+1), right?
3.For each m, we decide it's odd or even. For odd m, we have to decide
how many b could be divided by m. For even m, we have to decide
how many b could be divided by m/2.

Test data

Posted: Thu Dec 09, 2004 8:02 pm
by hackfox
Some input and the output of my program.

4
-1000 1000 -1000 1000 1 1000
-1000 1000 -1000 1000 1 1
-1000 1000 -1000 1000 1 2
-1000 0 -1000 0 1 1000

Output
Case 1: 43813896
Case 2: 4004001
Case 3: 8008002
Case 4: 11459448

Yeah...

Posted: Thu Dec 09, 2004 9:13 pm
by hackfox
Finally I got Accept :D

Here are some cases I failed to consider.

Input
3
1 1 -1 -1 3 3
1 1 -3 -2 3 3
1 1 -5 -1 3 3

Output
Case 1: 0
Case 2: 1
Case 3: 1