QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#694227#6749. Targetzxk#WA 0ms3628kbC++17699b2024-10-31 17:30:462024-10-31 17:30:50

Judging History

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

  • [2024-10-31 17:30:50]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3628kb
  • [2024-10-31 17:30:46]
  • 提交

answer

#include <iostream>

using namespace std;

const int mod=998244353;

int pre[10000001];

inline int quick_pow(int base,int index)
{
	long long ans=1,tmp=base;
	
	while(index){
		if(index&1){
			ans*=tmp;
			ans%=mod;
		}
		tmp*=tmp;
		tmp%=mod;
		index>>=1;
	}
	
	return ans;
}

int get_inv(int x)
{
	return quick_pow(x,mod-2);
}

int get_CC(int down,int up)
{
	return 1ll*pre[down]*get_inv(pre[down-up])%mod;
}

signed main()
{
	int n;
	cin>>n;
	
	pre[0]=1;
	for(int i=1;i<=n;i++){
		pre[i]=1ll*pre[i-1]*i%mod;
	}
	
	int ans=0;
	for(int i=1;i<=(n+1)/2;i++){
		ans+=1ll*pre[n-i]*get_CC(n-i,i-1)%mod;
		ans%=mod;
	}
	
	cout<<ans;
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3628kb

input:

0.5 0.25

output:

0

result:

wrong answer wa