#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
#define M 5010
int main()
{
int n;
while (cin >> n)
{
int a[M] = { 0 }, sum = 0;
for (int i = 0; i < n; i++)
{
cin >> a[i];
sum += a[i];
}
sum /= 2;
int ag = 0, now = 0, bg = 0;
int round = 1;
while (ag <= sum&&bg <= sum&&now<=n) //谁先超过一半 就赢
{
int s = 0;
if (a[now] >= a[now+1] + a[now+2]) //避免后面的打牌被对手拿到
{
s = a[now];
now += 1;
}
else //减少与对手的差距
{
s = a[now] + a[now + 1];
now += 2;
}
if (round == 1) //谁的回合
{
ag += s;
round = 2;
}
else
{
bg += s;
round = 1;
}
}
if (ag>sum) cout << "true" << endl;
else cout << "false" << endl;
}
}
#include <cmath>
#include <algorithm>
using namespace std;
#define M 5010
int main()
{
int n;
while (cin >> n)
{
int a[M] = { 0 }, sum = 0;
for (int i = 0; i < n; i++)
{
cin >> a[i];
sum += a[i];
}
sum /= 2;
int ag = 0, now = 0, bg = 0;
int round = 1;
while (ag <= sum&&bg <= sum&&now<=n) //谁先超过一半 就赢
{
int s = 0;
if (a[now] >= a[now+1] + a[now+2]) //避免后面的打牌被对手拿到
{
s = a[now];
now += 1;
}
else //减少与对手的差距
{
s = a[now] + a[now + 1];
now += 2;
}
if (round == 1) //谁的回合
{
ag += s;
round = 2;
}
else
{
bg += s;
round = 1;
}
}
if (ag>sum) cout << "true" << endl;
else cout << "false" << endl;
}
}