Cod sursa(job #1940089)
Utilizator | Data | 26 martie 2017 13:30:17 | |
---|---|---|---|
Problema | Invers modular | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.32 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("inversmodular.in");
ofstream fout("inversmodular.out");
int main()
{
int a, n;
fin >> a >> n;
for (int x = 1; x <= n - 1; ++x)
if (a * x % n == 1)
{
fout << x;
return 0;
}
}