警示后人
  • 板块P1976 鸡蛋饼
  • 楼主xgw120121
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/8/24 12:25
  • 上次更新2024/8/24 15:02:12
查看原帖
警示后人
786605
xgw120121楼主2024/8/24 12:25

这道题模数不是我们想的那样,那是1e8+71e8+7,像这份代码就过不了样例。

#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
long long f[3000];  
int n; 
int main() 
{   
    f[0]=1;f[1]=1; 
    cin>>n;  
    for(int i=2;i<=n;i++)  
        for(int j=0;j<i;j++) 
            f[i]=(f[i]+f[j]*f[i-j-1]%mod)%mod;    
    cout<<f[n];  
    return 0;  
}

警示后人!!!!!

2024/8/24 12:25
加载中...