Cod sursa(job #591424)
Utilizator | Data | 24 mai 2011 08:56:59 | |
---|---|---|---|
Problema | Invers modular | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.24 kb |
#include<fstream>
using namespace std;
ifstream f("inversmodular.in");
ofstream g("inversmodular.out");
int main()
{int a,n,x,ok=0;
f>>a>>n;
x=1;
do
{if(((a*x)%n)==1) {g<<x; ok=1;}
x++;
}while(x<=n-1 && !ok);
return 0;
}