Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>#include <algorithm>using namespace std;typedef long long LL;const int MAXN = 1e3+5;void Ex_gcd(LL a, LL b, LL &x, LL &y){if(b == 0){x = 1;y = 0;return ;}LL x1, y1;Ex_gcd(b, a%b, x1, y1);x = y1;y = x1-(a/b)*y1;}LL GCD(LL a, LL b){if(b == 0)return a;return GCD(b, a%b);}LL m[MAXN],r[MAXN], n;LL Solve(){LL M = m[1], R = r[1], d, k1, k2, c;