文章
4
粉丝
139
获赞
1
访问
4.1k
具体解析见:https://blog.csdn.net/qq_17807067/article/details/127231568
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n,p;
ll inv[20000528];
int main(){
scanf("%d %d",&n,&p);
inv[1]=1;//1的逆元是1
printf("%ld\n",inv[1]);
for(int i=2;i<=n;i++){
inv[i]=(p-p/i)*inv[p%i]%p;
printf("%ld\n",inv[i]);
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发