QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#406507#8543. Periodic SequencexiaolangWA 1ms3564kbC++14534b2024-05-07 13:03:452024-05-07 13:03:47

Judging History

你现在查看的是最新测评结果

  • [2024-05-07 13:03:47]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3564kb
  • [2024-05-07 13:03:45]
  • 提交

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;
} 

Details

Tip: Click on the bar to expand more detailed information

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'