Cod sursa(job #2970549)

Utilizator bogdann31Nicolaev Bogdan bogdann31 Data 25 ianuarie 2023 15:15:46
Problema Invers modular Scor 30
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 1.52 kb
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define mod               1000000007
#define ll                 long long 
#define ld                 long double
#define pb                 push_back
#define pp                 pop_back
#define FAST               ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mp                 make_pair
#define all(v)             v.begin(), v.end()
#define SORT(v)            sort(ALL(v))  
#define REVERSE(v)         reverse(ALL(v))
#define maxc(v)            max_element(all(v))
#define minc(v)            min_element(all(v))
#define GCD(m,n)           __gcd(m,n)
#define LCM(m,n)           m*(n/GCD(m,n))
#define fr(n)              for(ll i=0;i<n;++i)
#define frr(i,a,b)         for(ll i=a;i<=b;++i)
#define ctz(x)             __builtin_ctz(x)
#define clz(x)             __builtin_clz(x)
#define pcount(x)          __builtin_popcountll(x)
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
#define cin fin
#define cout fout
ifstream fin("inversmodular.in");
ofstream fout("inversmodular.out");



void solve(){
    ll a, n;cin>>a>>n;
    for(ll i=n+1; i<=a*n; i+=n){
        if(i%a==0){
            cout<<i/a;return;
        }
    }
    
}


int main(){
    // p[0]=1;
    // for(ll i=1; i<1000001; i++){
    //     p[i]=p[i-1]*i%1000000007;
    // }
    
    // ll t;cin>>t;while(t--){solve();cout<<endl;}

    solve();
    // for(ll i=0; i<n; i++){
    //     for(ll j=0; j<m; j++){
    //         cout<<b[i][j];
    //     }
    //     cout<<"\n";
    // }
    
    

}