QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#406504 | #8543. Periodic Sequence | xiaolang | WA | 1ms | 3740kb | C++14 | 534b | 2024-05-07 13:02:50 | 2024-05-07 13:02:51 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e6+5;
int n,MOD;
int d[N][26];
signed main(){
scanf("%lld%lld",&n,&MOD);
for(int i=1;i<=26;i++)d[0][i]=1;
for(int i=1;i<=n;i++){
for(int j=1;j<=26;j++){
for(int k=1;k<=j;k++){
if(i>=k)d[i][j]=(d[i][j]+d[i-k][j])%MOD;
}
}
}
int tot=0;
for(int i=1;i<=n;i++){
int ans=0;
for(int j=1;j<=min(26*1ll,n);j++){
ans=(ans+d[i-j][j])%MOD;
}
tot=(tot+ans)%MOD;
cout<<tot<<" ";
}
cout<<"\n";
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3740kb
input:
5 1000000007
output:
83844306 962892491 912375832 912375837 912375845
result:
wrong answer 1st numbers differ - expected: '1', found: '83844306'