Cod sursa(job #2044763)
Utilizator | Data | 21 octombrie 2017 13:21:00 | |
---|---|---|---|
Problema | Invers modular | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.23 kb |
#include <fstream>
using namespace std;
ifstream in("inversmodular.in");
ofstream out("inversmodular.out");
int main()
{
int a,n,x=1,i;
in>>a>>n;
for(i=1;i<=n-2;i++)
x=(x*a)%n;
out<<x;
return 0;
}