Cod sursa(job #879531)
Utilizator | Data | 15 februarie 2013 16:17:16 | |
---|---|---|---|
Problema | Invers modular | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.22 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;((long long)n*c+1)%a!=0;c++);
fout<<(n*c+1)/a;
}