Cod sursa(job #2037766)
Utilizator | Data | 12 octombrie 2017 19:14:11 | |
---|---|---|---|
Problema | Invers modular | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.3 kb |
#include <fstream>
using namespace std;
ifstream cin("inversmodular.in");
ofstream cout("inversmodular.out");
int main()
{
int n,a,x,k=1;
cin >> a >> n;
while((n*k+1)%a != 0)
k++;
x = (n*k+1)/a;
cout << x;
cin.close();
cout.close();
return 0;
}