Cod sursa(job #2839216)

Utilizator armand09Armand Miron armand09 Data 25 ianuarie 2022 15:54:31
Problema Invers modular Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.46 kb
#include <bits/stdc++.h>
#define LL long long
using namespace std;
#define pb push_back
#define FASTIO ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0)

ifstream f("inversmodular.in");
ofstream g("inversmodular.out");

#define pii pair<int , int>
#define sz(a) ((int)((a).size()))
const int MAX = INT_MAX;
LL inv(LL a, LL b){
    return 1<a ? b - inv(b%a,a)*b/a : 1;
}
int a, b;
int32_t main()
{
    FASTIO;
    f>>a>>b;
    g<<inv(a ,b);
}