@[LChen](/user/675837) 我绝对不会骗你主要函数:
```cpp
//the code is from chenjh
#include<bits/stdc++.h>
using namespace std;
int inv[3000003];
void getinv(int n,int mod){
inv[1]=1;
for(int i=2;i<=n;i++)
inv[i]=(long long)(mod-mod/i)*inv[mod%i]%mod;
}
int main(){
int n,p;
scanf("%d%d",&n,&p);
getinv(n,p);
for(int i=1;i<=n;i++) printf("%d\n",inv[i]);
return 0;
}
```
by cjh20090318 @ 2022-07-22 09:08:31
@[cjh20090318](/user/577880) ![](//图.tk/e)![](//图.tk/e)
by LChen @ 2022-07-22 09:10:41