QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#356253#6736. Alice and Bobstar_xiao#WA 1ms7756kbC++14973b2024-03-17 17:05:062024-03-17 17:05:06

Judging History

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

  • [2024-03-17 17:05:06]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:7756kb
  • [2024-03-17 17:05:06]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

//int n;
const int N=1e7+10;
#define int long long 
const int mod=998244353;

int sum[N];
int fac[N],infac[N];
int n;

int qmi(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1) res=res*a%mod;
		b>>=1;
		a=a*a%mod;
	}
	return res%mod;
}

void init()
{
	fac[0]=infac[0]=1;
	for(int i=1;i<=n;i++)
	{
		fac[i]=fac[i-1]*i%mod;
		infac[i]=infac[i-1]*qmi(i,mod-2)%mod;
	}
}

int C(int a,int b)
{
	return fac[b]*infac[a]%mod*infac[b-a]%mod;
}


void solve()
{
	int ans=0;
	cin>>n;
	sum[0]=1;
	init();
	//cout<<C(3,2);
	for(int i=1;i<=n;i++)
	{
		//ans=ans*i%mod;
		sum[i]=sum[i-1]*i%mod;
		
	}
	sum[0]=0;
	ans=(ans+sum[n-1]+mod)%mod;
	for(int i=2;i<=n;i++)
	{
		ans=(ans+(C(i-1,n-i)%mod)*sum[i-1]%mod*sum[n-i]%mod+mod)%mod;
		//cout<<ans<<'\n';
	}
	cout<<ans%mod;
	
}
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	
	solve();
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 7756kb

input:

1

output:

0

result:

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