alg2025/src/2/P1495.cpp
2025-02-07 09:38:45 +08:00

38 lines
641 B
C++

#include <cstdint>
#include <iostream>
#include <tuple>
#include <vector>
using ll = int64_t;
std::tuple<ll,ll,ll> exgcd(const ll &a,const ll &b){
if(b==0){
ll x=1,y=0;
return std::make_tuple(a,x,y);
}
auto[d,x,y] = exgcd(b, a%b);
const ll tmpy = y;
y=x-a/b*y;
x=tmpy;
return std::make_tuple(d,x,y);
}
ll inv(const ll &n,const ll &p){
auto[d,x,y]=exgcd(n, p);
x=(x%p+p)%p;
return x;
}
int main(){
ll N;
std::cin>>N;
std::vector<ll> p(N),n(N);
for(ll i{0};i<N;i++){
std::cin>>p[i]>>n[i];
}
ll prod{1};
for(ll pi:p){
prod=prod*pi;
}
}