ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#213799 | #2157. 数列 | zhangxinyang111 | Compile Error | / | / | C++ | 455b | 2024-11-13 19:55:56 | 2024-11-13 23:04:04 |
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e6+7;
int f[N];
int n,p;
int qpow(int a,int b,int p)
{
int ans=1;
while(b)
{
if(b&1) ans=ans*a%p;
a=a*a%p;
b>>=1;
}
return ans;
}
signed main()
{
cin.tie(nullptr) -> ios::sync_with_stdio(false);
cin>>n>>p;
f[1]=1;
for(int i=2;i<=n;i++) f[i]=f[i-1]*(4*i-2)%p*qpow((i+1),p-2,p)%p;
cout<<f[n]%p;
return 0;
}
//f[n]=f[n-1]*(4*n-2)/(n+1)
详细
answer.code: In function 'int main()': answer.code:20:10: error: 'nullptr' was not declared in this scope cin.tie(nullptr) -> ios::sync_with_stdio(false);\x0d ^