Cod sursa(job #1394459)

Utilizator Iustin48Ventaniuc Iustin Iustin48 Data 20 martie 2015 12:32:14
Problema Invers modular Scor 10
Compilator cpp Status done
Runda Arhiva educationala Marime 0.26 kb
#include <fstream>
//a*x=n*c+1 <==> x= (n*c+1)/a
using namespace std;
ifstream f("inversmodular.in");
ofstream g("inversmodular.out");
int a,n,c;
int main()
{
    f>>a>>n;
    c=1;
    while((n*c+1)%a!=0)
        c++;
    g<<(n*c+1)/a;
    return 0;
}