Cod sursa(job #844465)
Utilizator | Data | 29 decembrie 2012 13:02:40 | |
---|---|---|---|
Problema | Invers modular | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.21 kb |
#include <fstream>
using namespace std;
ifstream fin("inversmodular.in");
ofstream fout("inversmodular.out");
int main ()
{
long a,n,c;
fin>>a>>n;
for(c=0;(n*c+1)%a!=0;c++);
fout<<(n*c+1)/a;
}