AC 存疑求助
查看原帖
AC 存疑求助
639198
Steve_xh楼主2024/12/1 12:56

没过样例啊!

#include<bits/stdc++.h>
// #define int long long
using namespace std;
typedef long long ll;
const int MAXN=100005,mod=19260817,inf=0x3f3f3f3f;
ll read(){
    ll reans;char ch=getchar();
    while(!isdigit(ch))ch=getchar();
    while(isdigit(ch))reans=((reans<<1)+(reans<<3)+(ch^48))%mod,ch=getchar();
    return reans;
}
void write(ll x){
    if(x<0)putchar('-'),x=-x;
    if(x<10)return (void)putchar(x+48);
    write(x/10);
    putchar(x%10+48);
}
ll a,b,x,y;
void exgcd(ll a,ll b,ll &x,ll &y){
    if(!b)
        return (void)(x=1,y=0);
    exgcd(b,a%b,y,x);
    y-=a/b*x;
}
signed main(){
    // cin.tie(nullptr)->sync_with_stdio(false);
    a=read(),b=read();
    if(b%mod==0)
        return puts("Angry!"),0;
    exgcd(b,mod,x,y);
    write(((x%mod+mod)%mod)*a%mod);
    return 0;
}
2024/12/1 12:56
加载中...