Cod sursa(job #1940092)

Utilizator FrequeAlex Iordachescu Freque Data 26 martie 2017 13:31:26
Problema Invers modular Scor 30
Compilator cpp Status done
Runda Arhiva educationala Marime 0.34 kb
#include <iostream>
#include <fstream>

using namespace std;

ifstream fin("inversmodular.in");
ofstream fout("inversmodular.out");

int main()
{
    long long int a, n;
    fin >> a >> n;
    for (long long int x = 1; x <= n - 1; ++x)
        if (a * x % n == 1)
        {
            fout << x;
            return 0;
        }
}