标签:break printf cst .com ++ out http img bsp
#include<cstdio> using namespace std; int a,b; int gcd(int x,int y){ if(y==0)return x; return gcd(y,x%y); } int main(){ scanf("%d%d",&a,&b); printf("%d",gcd(a,b)); }
#include<iostream> #include<cstdio> #include<cstdlib> using namespace std; #define ll long long ll a,b,x,y; ll exgcd(ll a,ll b){ if(b==0){ x=1;y=0; return a; } exgcd(b,a%b); ll tmp=x; x=y;y=tmp-(a/b)*y; } int main(){ scanf("%lld%lld",&a,&b); exgcd(a,b); while(x<0)x+=b; cout<<x; }
void prepare(){ for(int i=2;i<=n;i++){ if(!vis[i])p[++cnt]=i; for(int j=1;j<=cnt&&i*p[j]<=n;j++){ vis[i*p[j]]=1; if(i%p[j]==0)break; } } }
int euler_phi(int n){//单个欧拉函数 int m=(int)sqrt(n+0.5); int ans=n; for(int i=2;i<=m;i++)if(n%i==0){ ans=ans/i*(i-1); while(n%i==0)n/=i; } if(n>1)ans=ans/n*(n-1); }
标签:break printf cst .com ++ out http img bsp
原文地址:http://www.cnblogs.com/thmyl/p/7791479.html