标签:include stream https main void pre dsc 代码 turn
[https://www.cnblogs.com/qdscwyy/p/7795368.html]
A[i]=-(p/i)*A[p%i];
#include<iostream>
#include<cstdio>
#define N 3000005
using namespace std;
typedef long long ll;
ll _inv[N];
void pre(int MOD){
_inv[0]=_inv[1]=1;
for(int i=2;i<N;i++)
_inv[i]=((MOD-MOD/i)*_inv[MOD%i])%MOD;
}
int main(){
int n,p;
cin>>n>>p;
pre(p);
for(int i=1;i<=n;++i)
printf("%d\n",_inv[i]);
return 0;
}
标签:include stream https main void pre dsc 代码 turn
原文地址:https://www.cnblogs.com/mch5201314/p/11231630.html