반응형
#include<stdio.h>
int main()
{
int arr[100000], t, n;
int c, z;
long long x1, x2;
long long y_sum;
bool check = true;
scanf("%d", &t);
for (int i = 0; i < t; i++)
{
c = 0;
z = 0;
x1 = 0;
x2 = 0;
y_sum = 0;
scanf("%d", &n);
check = true;
for (int j = 0; j < n; j++)
{
scanf("%d", &arr[j]);
y_sum += arr[j];
}
x1 = arr[0];
x2 = arr[n - 1];
if (x1 <= 0 || x2 <= 0)
{
check = false;
}
for (int j = 1; j < n; j++)
{
x1 = x1 + arr[j];
x2 = x2 + arr[n - 1 - j];
if (x1 <= 0 || x2 <= 0)
{
check = false;
break;
}
}
if (check == false)
{
printf("NO\n");
}
else
{
printf("YES\n");
}
}
return 0;
}
https://codeforces.com/contest/1285/problem/B
반응형
'🧩PS > 🥈Nomal' 카테고리의 다른 글
[C/C++] Codeforce 466C - Number of Ways (0) | 2020.04.04 |
---|---|
[C/C++] Codeforce 734B - Anton and Digits (0) | 2020.04.04 |
[C/C++] Codeforce 118A - String Task (tolower, toupper 함수) (0) | 2020.03.22 |
[C/C++] Codeforce 71A - Way Too Long Words (0) | 2020.03.22 |
[C/C++] Codeforce 4A - Watermelon (0) | 2020.03.22 |