#include<cstdio> #include<iostream> using namespace std; int exgcd(int a,int b,int &x,int &y){ if(!b){ x=1,y=0; return a; } int d=exgcd(b,a%b,x,y); int tmp=x; x=y,y=tmp-(a/b)*y; return d; } int main(){ int a,b,x,y; scanf("%d%d",&a,&b); exgcd(a,b,x,y); printf("%d %d\n",x,y); return 0; }
a