Pagini recente » Cod sursa (job #3005107) | Cod sursa (job #2904169) | Diferente pentru problema/aranjare2 intre reviziile 2 si 3 | Cod sursa (job #3128926) | Cod sursa (job #695179)
Cod sursa(job #695179)
#include<cstdio>
long long x,y;
void eucl(long long a,long long b){
if(!b){
x=1;
y=0;
return;
}
eucl(b,a%b);
int tmp=y;
y=x-(a/b)*y;
x=tmp;
}
int main()
{
freopen ("inversmodular.in","r",stdin);
freopen ("inversmodular.out","w",stdout);
int a,n;
scanf ("%d%d",&a,&n);
eucl (a,n);
printf ("%d",x);
return 0;
}