要求(A/B)%9973,但由於A很大,我們只給出n(n=A%9973)(我們給定的A必能被B整除,且gcd(B,9973) = 1)。
Input
數據的第一行是一個T,表示有T組數據。
每組數據有兩個數n(0 <= n < 9973)和B(1 <= B <= 10^9)。
Output
對應每組數據輸出(A/B)%9973。
Sample Input
2
1000 53
87 123456789
Sample Output
7922
6060
#include <iostream>
using namespace std;
int main()
{
int t;
long long int n,b;
cin >> t;
for(int j=0;j<t;j++)
{
cin >> n >> b;
int i;
for (i = 0; i <= 10000; i++)
if ((b*i - n) % 9973 == 0)
break;
cout<<i<<endl;
}
}