Cod sursa(job #2269576)
| Utilizator | Data | 26 octombrie 2018 10:46:22 | |
|---|---|---|---|
| Problema | Invers modular | Scor | 30 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.41 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("inversmodular.in");
ofstream fout("inversmodular.out");
int main()
{
long long a,n;
fin >> a >> n;
int p=0;
bool ok=1;
while(ok==1)
{
p++;
long long prod=1LL*n*p+1;
if(prod%a==0)
{
fout << prod/a;
ok=0;
}
}
return 0;
}
