比赛 Asm_Def战记之透明计算网络 评测结果 WWWWWWWWWW
题目名称 Asm_Def排兵布阵 最终得分 0
用户昵称 VG|Kn. 运行时间 0.003 s
代码语言 C++ 内存使用 0.34 MiB
提交时间 2015-11-01 09:37:13
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;

const int maxk = 1000 + 10;
const int maxs = 5000 + 10;
int k, num[maxk];
long l[maxs];
int count = 0, sum = 0;
long long ans;

void fun()
{
	int t = 1, r = 1, u ,v, w, o;
	bool b;
	for (int i = 2; i <= k; i++)
	{
		t = t * num[i];
	}
	o = sum - k;
	for (int i = 1; i <= o; i++)
	{
		r = r * i;
	}
	ans = r * t -(r-1) * (t-1);
}

int main()
{
	freopen("asm_formation.in","r",stdin);
	freopen("asm_formation.out","w",stdout);
	cin >> k;
	for (int i = 1; i <= k; i++)
	{
		cin >> num[i];
		sum += num[i];
	}
	fun();
	cout << ans % 998244353 << endl;
	return 0;
}