Cod sursa(job #2100596)
Utilizator | Data | 5 ianuarie 2018 21:13:04 | |
---|---|---|---|
Problema | Invers modular | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.26 kb |
#include <fstream>
using namespace std;
ifstream f("inversmodular.in");
ofstream g("inversmodular.out");
unsigned long long n,a,x,k=1;
int main()
{
f>>a>>n;
while((n*k+1)%a != 0)
k++;
x = (n*k+1)/a;
g<<x;
return 0;
}