暴力70分...

P1082 [NOIP2012 提高组] 同余方程

哈哈我也一样 ```cpp #include<iostream> #include<cstdio> #include<algorithm> using namespace std; #define LL long long int LL a,b,ans; int main(){ //freopen("zouyudong.in","r",stdin); //freopen("zouyudong.out","w",stdout); scanf("%ld%ld",&a,&b); ans=b+1; for(LL i=0;;i++){ if(ans%a==0){ printf("%ld",ans/a); break; } ans+=b; } return 0; } ```
by 邹榆冬 @ 2017-09-16 16:18:09


加一 ```cpp #include<bits/stdc++.h> using namespace std; int main() { int a,b,ans=1; cin>>a>>b; while((a*ans)%b!=1) { ans++; } cout<<ans; return 0; } ```
by 杰杰 @ 2017-10-20 18:53:58


violet++; ```cpp #include<stdio.h> int main() { long long int a,b; scanf("%lld%lld",&a,&b); long long int qaq=a%b; long long int count=0; long long int sum=0; for(;sum!=b+1;sum+=qaq,count++) { if(sum>b+1) sum-=b; } printf("%lld",count); return 0; } ```
by 以有涯随无涯 @ 2018-05-06 16:45:35


@[杰杰](/space/show?uid=58749) 你这最多40
by 十言 @ 2018-10-21 09:50:27


|