hdu 1576
设(A/B)%9973=C,则A = 9973*k*B + B*C;得(B*C)%9973 = A % 9973;
C一定存在且唯一,所以只要穷举一下就找出来了。
/*
* hdu1576/win.cpp
* Created on: 2011-11-28
* Author : ben
*/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <functional>
#include <numeric>
#include <cctype>
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
freopen("data.in", "r", stdin);
#endif
int T, B, _B, n;
const int MOD = 9973;
scanf("%d", &T);
while(T--) {
scanf("%d%d", &n, &B);
_B = B % MOD;
for(int c = 0; c < MOD; c++) {
if((_B * c) % MOD == n) {
printf("%d\n", c);
break;
}
}
}
return 0;
}