标签:log == back main tar 拓展欧几里得 name get using
水~
纯拓展欧几里得算法。。
#include<iostream> #include<cstdio> #define ll long long using namespace std; ll ans; int a,b; void exgcd(int a,int b,int &x,int &y) { if(b==0){x=1;y=0;return;} exgcd(b,a%b,x,y); int t=x;x=y,y=t-a/b*y; } int main() { cin>>a>>b; int x,y; exgcd(a,b,x,y); x=(x%b+b)%b; cout<<x<<endl; return 0; }
标签:log == back main tar 拓展欧几里得 name get using
原文地址:http://www.cnblogs.com/ghostfly233/p/6831007.html