求助,全WA
查看原帖
求助,全WA
231591
FishingStar楼主2020/8/26 12:20
#include <cstdio>
#include<iostream>
using namespace std;
const int mod = 19260817;
long long x, y;
long long q(){
	int f = 1;
    int res = 0, ch = getchar();
    while((ch > '9'|| ch < '0') && ch != EOF){
    	if(ch == '-'){
    	    f = -1;
		}
        ch = getchar();
    }
    while(ch <= '9' && ch >= '0' && ch != EOF){
        res = (res * 10 + (ch - '0')) % mod;
        ch = getchar();
    }
    return res * f;
}
void exgcd(long long a, long long b){
	if(b == 0){
		x = 1;
		return;
	} 
	exgcd(b, a % b);
	long long tx = x;
	x = y;
	y = tx - a / b * y; 
	return;
}

int main(){
	long long a, b;
    a = q();
    b = q();
    if(b == 0){
        cout << "Angry!";
        return 0;
    }
    exgcd(b, mod);
    cout << (a * (x % mod + mod) % mod) % mod;
    return 0;
}
2020/8/26 12:20
加载中...