QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#406504#8543. Periodic SequencexiaolangWA 1ms3740kbC++14534b2024-05-07 13:02:502024-05-07 13:02:51

Judging History

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

  • [2024-05-07 13:02:51]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3740kb
  • [2024-05-07 13:02:50]
  • 提交

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

Details

Tip: Click on the bar to expand more detailed information

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'