This commit is contained in:
Zengtudor 2024-11-14 18:05:15 +08:00
parent 27d3dd0aa3
commit 56b1fdd6c4

23
src/P3811/P3811.cpp Normal file
View File

@ -0,0 +1,23 @@
#include <cstdint>
#include <iostream>
int main(){
using ll = int64_t;
ll n,p;
std::cin>>n>>p;
auto pow = [](ll b, ll e, ll m)->ll{
b%=m;
ll res{1};
while(e!=0){
if(e&1){
res=(res*b)%m;
}
e>>=1;
b=(b*b)%m;
}
return res;
};
for(ll i{1};i<=n;i++){
std::cout<<pow(i, p-2, p)<<'\n';
}
}