标签:ace stream cout amp blog span namespace str clu
#include <iostream> #include <string> #include <cstring> #include <cstdio> #include <cmath> #include <cstdlib> #include <algorithm> using namespace std; int extend_gcd(int a, int b, int &x, int &y) { if (b == 0) { x = 1, y = 0; return a; } int t = extend_gcd(b, a % b, y, x); y -= a / b * x; return t; } int main() { int T, n, b, x, y; cin >> T; while (T--) { cin >> n >> b; extend_gcd(9973, b, x, y); y *= n; y = (9973 + y % 9973) % 9973; cout << y << endl; } }
标签:ace stream cout amp blog span namespace str clu
原文地址:http://www.cnblogs.com/NWUACM/p/6746522.html