QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#406513#8543. Periodic SequencexiaolangTL 1ms3824kbC++14526b2024-05-07 13:08:202024-05-07 13:08:21

Judging History

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

  • [2024-05-07 13:08:21]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:3824kb
  • [2024-05-07 13:08:20]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e3+5;
int n,MOD;
int d[N][N];
signed main(){
	scanf("%lld%lld",&n,&MOD);
	for(int i=1;i<=n;i++)d[0][i]=1;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;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(n,i);j++){
			ans=(ans+d[i-j][j])%MOD;
		}
		tot=(tot+ans)%MOD;
		cout<<tot<<" ";
	}
	cout<<"\n";
	return 0;
} 

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3824kb

input:

5 1000000007

output:

1 3 6 11 19 

result:

ok 5 number(s): "1 3 6 11 19"

Test #2:

score: -100
Time Limit Exceeded

input:

200000 567894337

output:


result: