QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#474963#6736. Alice and Bobszy10010WA 483ms81824kbC++171.5kb2024-07-13 09:53:262024-07-13 09:53:26

Judging History

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

  • [2024-07-13 09:53:26]
  • 评测
  • 测评结果:WA
  • 用时:483ms
  • 内存:81824kb
  • [2024-07-13 09:53:26]
  • 提交

answer

#include <map>
#include <queue>
#include <deque>
#include <cmath>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <unordered_map>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define pp pop_back()
#define int long long
#define lowbit(x) ((x)&(-x))
#define double long double
#define sf(x) scanf("%lld",&x)
#define sff(x,y) scanf("%lld %lld",&x,&y)
#define all(x) (x).begin(), (x).end()
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef unsigned long long ULL;
typedef pair<int,int>PII;
const int N=1e7+10,INF=4e18,P=998244353;
int n,m,cnt;
int A[N];
int qmi(int a,int b,int P)
{
	int res=1;
	while(b)
	{
		if(b&1)res=res*a%P;
		a=a*a%P;
		b>>=1;
	}
	return res;
}
void init()
{
	int now=1,fnow=1;
	for(int i=1;i<=10000000;i++)
	{
		now=now*i%P;
		A[i]=now;
	}
	return;
}
//bool st[20];
//int cun[20];
//int cunres[20];
//void dfs(int ii)
//{
//	if(ii==11)
//	{
//		for(int i=2;i<=cun[1];i++)
//		{
//			if(cun[i]<cun[1])return;
//		}
//		cunres[cun[1]]++;
//		return ;
//	}
//	for(int i=1;i<=10;i++)
//	{
//		if(!st[i])
//		{
//			st[i]=true;
//			cun[ii]=i;
//			dfs(ii+1);
//			st[i]=false;
//		}
//	}
//}
void solve()
{
	cin>>n;
	int res=0;
	for(int i=1;i<=n;i++)
		if(n-2*i+1>0)res=(res+A[n-i]*qmi(A[n-2*i+1],P-2,P)%P*A[n-i]%P)%P;
	if(n==1)cout<<1<<endl;
	else cout<<res<<endl;
	return ;
}
signed main()
{
	init();
	IOS;
	int T=1;
//	cin>>T;
	while(T--)
		solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 48ms
memory: 81676kb

input:

1

output:

1

result:

ok 1 number(s): "1"

Test #2:

score: 0
Accepted
time: 50ms
memory: 81632kb

input:

2

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 47ms
memory: 81748kb

input:

10

output:

997920

result:

ok 1 number(s): "997920"

Test #4:

score: 0
Accepted
time: 42ms
memory: 81676kb

input:

100

output:

188898954

result:

ok 1 number(s): "188898954"

Test #5:

score: 0
Accepted
time: 24ms
memory: 81696kb

input:

4

output:

10

result:

ok 1 number(s): "10"

Test #6:

score: 0
Accepted
time: 43ms
memory: 81748kb

input:

8

output:

12336

result:

ok 1 number(s): "12336"

Test #7:

score: 0
Accepted
time: 35ms
memory: 81752kb

input:

16

output:

373118483

result:

ok 1 number(s): "373118483"

Test #8:

score: 0
Accepted
time: 47ms
memory: 81744kb

input:

32

output:

314585464

result:

ok 1 number(s): "314585464"

Test #9:

score: 0
Accepted
time: 42ms
memory: 81824kb

input:

64

output:

627827331

result:

ok 1 number(s): "627827331"

Test #10:

score: 0
Accepted
time: 51ms
memory: 81764kb

input:

128

output:

828497685

result:

ok 1 number(s): "828497685"

Test #11:

score: 0
Accepted
time: 43ms
memory: 81732kb

input:

256

output:

65697890

result:

ok 1 number(s): "65697890"

Test #12:

score: 0
Accepted
time: 35ms
memory: 81700kb

input:

512

output:

854187619

result:

ok 1 number(s): "854187619"

Test #13:

score: 0
Accepted
time: 43ms
memory: 81728kb

input:

1024

output:

513823539

result:

ok 1 number(s): "513823539"

Test #14:

score: 0
Accepted
time: 121ms
memory: 81676kb

input:

1361956

output:

617368199

result:

ok 1 number(s): "617368199"

Test #15:

score: -100
Wrong Answer
time: 483ms
memory: 81664kb

input:

7579013

output:

693151411

result:

wrong answer 1st numbers differ - expected: '827172636', found: '693151411'