Cod sursa(job #1608478)

Utilizator alexb97Alexandru Buhai alexb97 Data 22 februarie 2016 09:26:26
Problema Invers modular Scor 30
Compilator cpp Status done
Runda Arhiva educationala Marime 0.3 kb
#include <fstream>
using namespace std;

ifstream is("inversmodular.in");
ofstream os("inversmodular.out");

long long x, a, n;

int main()
{
    is >> a >> n;
    x = 1;
    while((a%n)*(x%n) % n != 1)
    {
        x++;
    }
    os << x;
    is.close();
    os.close();
    return 0;
}