比赛 ZLXOI2015Day2 评测结果 AAAAAAAAAA
题目名称 沼跃鱼数列变换 最终得分 100
用户昵称 lyxin65 运行时间 0.040 s
代码语言 C++ 内存使用 1.46 MiB
提交时间 2015-10-30 21:00:16
显示代码纯文本
#include <bits/stdc++.h>

using namespace std;

const int maxn = 100005;
const int mod = 9999997;

int n, m;
int a[maxn];
int b[maxn];
int c[maxn];

void input()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
		scanf("%d", &a[i]);
	scanf("%d", &m);
	for(int i = 1; i <= m; ++i)
	{
		scanf("%d", &c[i]);
		b[c[i]] = 1;
	}
}

void solve()
{
	register int s = 1;
	for(int i = 1; i <= n; ++i)
		if(!b[i]) s = (long long)s * (a[i] + 1) % mod;
	register int ans = (s - 1 + mod) % mod;
	for(int i = 1; i <= m; ++i)
		ans = (ans + (long long)a[c[i]] * s) % mod;
	printf("%d\n", ans);
}

int main()
{
	freopen("Marshtomp.in", "r", stdin);
	freopen("Marshtomp.out", "w", stdout);
	
	input();
	solve();
	
	fclose(stdin);
	fclose(stdout);
	return 0;
}