QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#406507 | #8543. Periodic Sequence | xiaolang | WA | 1ms | 3564kb | C++14 | 534b | 2024-05-07 13:03:45 | 2024-05-07 13:03:47 |
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][30];
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: 3564kb
input:
5 1000000007
output:
20 45 15832 15837 15845
result:
wrong answer 1st numbers differ - expected: '1', found: '20'