Cod sursa(job #3237292)

Utilizator popescu_georgePopescu George popescu_george Data 8 iulie 2024 09:24:18
Problema Invers modular Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.24 kb
#include<fstream>
using namespace std;
ifstream F("inversmodular.in");
ofstream G("inversmodular.out");
int a,b,x=1,y,z,d,c,e;
int main()
{
    for(F>>a>>b,c=b;b;d=a%b,e=a/b,a=b,b=d,z=x,x=y,y=z-e*y);
    return G<<(x<0?c+x%c:x),0;
}