UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#213822#2157. 数列laiyishi50223ms1192kbC++11260b2024-11-13 20:32:352024-11-13 23:06:42

answer

#include<bits/stdc++.h>
using namespace std;
int n,p,c[1005];
int main(){
	scanf("%d%d",&n,&p);
	c[0]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=n-1;j++)c[i]=((1ll*c[j]*c[i-1-j]%p)+c[i])%p;
		//cout<<i<<' '<<c[i]<<'\n';
	} 
	printf("%d\n",c[n]);
} 

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 5
Accepted
time: 23ms
memory: 1192kb

input:

921 998054347

output:

345389219

result:

ok single line: '345389219'

Test #2:

score: 5
Accepted
time: 22ms
memory: 1192kb

input:

926 998064329

output:

458756691

result:

ok single line: '458756691'

Test #3:

score: 5
Accepted
time: 29ms
memory: 1192kb

input:

1000 998074327

output:

457273797

result:

ok single line: '457273797'

Test #4:

score: 5
Accepted
time: 26ms
memory: 1192kb

input:

952 998084303

output:

329700115

result:

ok single line: '329700115'

Test #5:

score: 5
Accepted
time: 31ms
memory: 1192kb

input:

989 998094347

output:

94788253

result:

ok single line: '94788253'

Test #6:

score: 5
Accepted
time: 25ms
memory: 1188kb

input:

902 998104313

output:

911969455

result:

ok single line: '911969455'

Test #7:

score: 5
Accepted
time: 14ms
memory: 1192kb

input:

914 998114333

output:

827812986

result:

ok single line: '827812986'

Test #8:

score: 5
Accepted
time: 20ms
memory: 1188kb

input:

986 998124313

output:

169699253

result:

ok single line: '169699253'

Test #9:

score: 5
Accepted
time: 15ms
memory: 1192kb

input:

947 998134339

output:

761932751

result:

ok single line: '761932751'

Test #10:

score: 5
Accepted
time: 18ms
memory: 1188kb

input:

934 998144339

output:

42889072

result:

ok single line: '42889072'

Test #11:

score: 0
Runtime Error

input:

991572 998154343

output:


result:


Test #12:

score: 0
Runtime Error

input:

932800 998164337

output:


result:


Test #13:

score: 0
Runtime Error

input:

903603 998174341

output:


result:


Test #14:

score: 0
Runtime Error

input:

958646 998184331

output:


result:


Test #15:

score: 0
Runtime Error

input:

983016 998194349

output:


result:


Test #16:

score: 0
Runtime Error

input:

922347 998204353

output:


result:


Test #17:

score: 0
Runtime Error

input:

976053 998214317

output:


result:


Test #18:

score: 0
Runtime Error

input:

957300 998224351

output:


result:


Test #19:

score: 0
Runtime Error

input:

921760 998234353

output:


result:


Test #20:

score: 0
Runtime Error

input:

912948 998244353

output:


result: