暴力2
#include<bits/stdc++.h> #define int long long using namespace std; signed main(){ int a,b; cin>>a>>b; for(int i=1;;++i){ if((i*b+1)%a==0){ cout<<(i*b+1)/a; return 0; } } return 0; }
暴力1
#include<bits/stdc++.h> using namespace std; int main(){ long long a,b; scanf("%ld%ld",&a,&b); for(long long i=1;i;i++){ if(i*a%b==1) { printf("%ld",i); return 0; } } return 0; }
标签:std,ld,系数,int,namespace,long,计算,main From: https://www.cnblogs.com/cutemush/p/16757217.html