QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#352808#6736. Alice and Bobmonster7000TL 6ms3700kbC++20650b2024-03-13 16:59:212024-03-13 16:59:21

Judging History

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

  • [2024-03-13 16:59:21]
  • 评测
  • 测评结果:TL
  • 用时:6ms
  • 内存:3700kb
  • [2024-03-13 16:59:21]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
int mod=998244353;
int qmi(int a,int b)
{
	int res=1;
	a%=mod;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		b>>=1;
		a=(a*a)%mod;
	}
	return res%mod;
}
int a(int n,int m)
{
	int aa=1;
	for(int i=n;m>=1;i--,m--)
	{
		aa=aa%mod*i%mod;
		aa=(aa+mod)%mod;
	}
//	cout<<"aa:"<<aa<<endl;
	return (aa+mod)%mod;
	
}
signed main()
{
	int n;
	cin>>n;
	int ans=0;
	for(int i=1;i*2<=n+1;i++)
	{
		int tt=a(n-i,i-1)%mod*a(n-i,n-i)%mod;
		
		tt=(tt+mod)%mod;
	//	cout<<"i:"<<tt<<endl;
		ans=(ans+tt)%mod;
		ans=(ans+mod)%mod;
	}
	cout<<(ans+mod)%mod<<endl;;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3612kb

input:

1

output:

1

result:

ok 1 number(s): "1"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

2

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

10

output:

997920

result:

ok 1 number(s): "997920"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3700kb

input:

100

output:

188898954

result:

ok 1 number(s): "188898954"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

4

output:

10

result:

ok 1 number(s): "10"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

8

output:

12336

result:

ok 1 number(s): "12336"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

16

output:

373118483

result:

ok 1 number(s): "373118483"

Test #8:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

32

output:

314585464

result:

ok 1 number(s): "314585464"

Test #9:

score: 0
Accepted
time: 1ms
memory: 3492kb

input:

64

output:

627827331

result:

ok 1 number(s): "627827331"

Test #10:

score: 0
Accepted
time: 1ms
memory: 3496kb

input:

128

output:

828497685

result:

ok 1 number(s): "828497685"

Test #11:

score: 0
Accepted
time: 1ms
memory: 3520kb

input:

256

output:

65697890

result:

ok 1 number(s): "65697890"

Test #12:

score: 0
Accepted
time: 3ms
memory: 3608kb

input:

512

output:

854187619

result:

ok 1 number(s): "854187619"

Test #13:

score: 0
Accepted
time: 6ms
memory: 3604kb

input:

1024

output:

513823539

result:

ok 1 number(s): "513823539"

Test #14:

score: -100
Time Limit Exceeded

input:

1361956

output:


result: