Pagini recente » Cod sursa (job #2849957) | Cod sursa (job #2567356) | Cod sursa (job #2688847) | Cod sursa (job #2894007) | Cod sursa (job #1496152)
#include <iostream>
#include <cstdio>
using namespace std;
int t,a,n,c;
int smek(int &x,int &y,int a,int b)
{
if (!b)
return a;
int r=a%b;
int cmmdc=smek(x,y,b,r);
int aux=x;
x=y;
y=aux-a/b*y;
return cmmdc;
}
void rezolv()
{
scanf("%d%d",&a,&n);
int x=1,y=0,d,k;
d=smek(x,y,a,n);
printf("%d",x,y);
}
int main()
{
freopen("inversmodular.in","r",stdin);
freopen("inversmodular.out","w",stdout);
rezolv();
return 0;
}