跳到正文

题解

T633365

#SUSPENDED#约 1 分钟
原文
文章信息与版本

文章信息

发布
2025年7月25日
收录
2025年12月12日
更新
2026年11月18日
篇幅
约 1 分钟

版本

  1. v1当前

T633365题目传送门

C++
#include<bits/stdc++.h>
using namespace std;
int n,ans[105],p;
int power(int a,int x){
    if(x==1)return a;
    if(x%2==0){
        return power(a%p,x/2)%p*power(a%p,x/2)%p;
    }else{
        return power(a%p,x/2)%p*power(a%p,x/2)%p*a%p; 
    }
}
int main(){
    cin>>n>>p;
    for(int i=1;i<=n;i++){
        ans[i]=power(i,p-2);
    }
    for(int i=1;i<=n;i++)cout<<ans[i]<<endl;
    return 0;
}
原文