抽象问题
查看原帖
抽象问题
397312
HarveyZ楼主2024/10/4 17:27

为啥开unsigned long long 过不了,long long能过

#include<bits/stdc++.h>
using namespace std;
typedef long long ull;
ull x,y,a,b;
void exgcd(ull a,ull b){
    if(b==0){
        x=1;
        y=0;
        return;
    }
    exgcd(b,a%b);
    ull tx=x;
    x=y;
    y=tx-a/b*y;
}
int main(){
    cin>>a;
    cin>>b;
    exgcd(a,b);
    cout<<(x%b+b)%b;
}
2024/10/4 17:27
加载中...