Все задачи на 5.10.17 13:00
This commit is contained in:
24
uts/session_py/dist_march_2k17/Sherlock.py
Normal file
24
uts/session_py/dist_march_2k17/Sherlock.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import sys
|
||||
|
||||
sys.stdin = open("input.txt", "r")
|
||||
sys.stdout = open("output.txt", "w")
|
||||
|
||||
test_num = int(input())
|
||||
for test in range(test_num):
|
||||
b = 'NO'
|
||||
n = int(input())
|
||||
a = list(map(int, input().split()))
|
||||
if n == 1:
|
||||
b = 'YES'
|
||||
elif n == 2:
|
||||
b = 'NO'
|
||||
else:
|
||||
left = 0
|
||||
right = sum(a[1:])
|
||||
for i in range(1, n-1):
|
||||
left += a[i - 1]
|
||||
right -= a[i]
|
||||
if left == right:
|
||||
b = 'YES'
|
||||
break
|
||||
print(b)
|
||||
Reference in New Issue
Block a user