NEFU 15 八阵图 （概率）

0
0
0
1. 云栖社区>
2. 博客>
3. 正文

## NEFU 15 八阵图 （概率）

angel_imp 2015-11-18 14:00:00 浏览949

Problem : 15
Time Limit : 1000ms
Memory Limit : 65536K
description

input

N r1 r2 rn
M rn+1 rn+m
W

output

sample_input
3
3 4 5 6
7 8 9 10 11 12 13 14
3
0
2 1 1
1
2 3 1
2 1 1
3

sample_output
Alive
hint

source

``````#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
using namespace std;

#define MM(a) memset(a,0,sizeof(a))

typedef long long LL;
typedef unsigned long long ULL;
const int maxn = 3e3+5;
const int mod = 1e9+7;
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
LL gcd(LL a, LL b)
{
if(b == 0)
return a;
return gcd(b, a%b);
}

int m[maxn], n[maxn];
int main()
{
int T, N, W, M;
scanf("%d",&T);
while(T--)
{
scanf("%d", &N);
int summ = 0, sumn = 0;
for(int i=0; i<N; i++)
{
scanf("%d",&n[i]);
sumn += n[i];
}
scanf("%d", &M);
for(int i=0; i<M; i++)
{
scanf("%d",&m[i]);
summ += m[i];
}
scanf("%d", &W);
if(N == 0)
{
continue;
}
int ave = (sumn+summ)/N;
if(ave <= W)
puts("Alive");
else