10787 - Modular Equations

All about problems in Volume 107. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
hackfox
New poster
Posts: 8
Joined: Fri Aug 08, 2003 9:39 pm

10787 - Modular Equations

Post 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.
hackfox
New poster
Posts: 8
Joined: Fri Aug 08, 2003 9:39 pm

Test data

Post 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
hackfox
New poster
Posts: 8
Joined: Fri Aug 08, 2003 9:39 pm

Yeah...

Post 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
Post Reply

Return to “Volume 107 (10700-10799)”