Write a program to check whether a triangle is valid or not, when the three angles of the triangle are the inputs. A triangle is valid if the sum of all the three angles is equal to 180 degrees.

-----Input-----

The first line contains an integer T, the total number of testcases. Then T lines follow, each line contains three angles  A, B and C, of the triangle separated by space. 

-----Output-----
For each test case, display 'YES' if the triangle is valid, and 'NO', if it is not, in a new line.

-----Constraints-----
- 1 ≤ T ≤ 1000
- 1 ≤ A,B,C ≤ 180

-----Example-----
Input

3 
40 40 100
45 45 90
180 1 1
Output

YES
YES
NO

Source: codechef | Difficulty: EASY
Tags: Geometry

Mathematics


Solutions:
for t in range(int(input())):
	(a, b, c) = map(int, input().split())
	if a + b + c == 180:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	L1 = list(map(int, input().split()))
	if sum(L1) == 180:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	(a, b, c) = map(int, input().split())
	sum = a + b + c
	if sum == 180:
		print('YES')
	else:
		print('NO')
	t = t - 1


test = int(input())
while test > 0:
	(a, b, c) = map(int, input().split())
	if a + b + c == 180:
		print('YES')
	else:
		print('NO')
	test -= 1


try:
	t = int(input())
	for i in range(0, t):
		(a, b, c) = map(int, input().split())
		if a + b + c == 180:
			print('YES')
		else:
			print('NO')
except:
	pass


t = int(input())
for i in range(t):
	(A, B, C) = map(int, input().split())
	if A + B + C == 180:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	z = list(map(int, input().split()))
	if sum(z) == 180:
		print('YES')
	else:
		print('NO')


def valid(a, b, c):
	if a + b + c == 180:
		print('YES')
	else:
		print('NO')
t = int(input())
while t:
	t = t - 1
	(a, b, c) = list(map(int, input().split()))
	valid(a, b, c)


n = int(input())
for i in range(n):
	(p, q, r) = map(int, input().split())
	if p + q + r == 180:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(x, y, z) = map(int, input().split())
	if x + y + z == 180:
		print('YES')
	else:
		print('NO')


s = int(input())
for i in range(s):
	(a, b, c) = list(map(int, input().split()))
	sum = 0
	sum = sum + a + b + c
	if sum == 180:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	(a, b, c) = map(int, input().split())
	together = a + b + c
	if together == 180:
		print('YES')
	else:
		print('NO')


a = int(input())
for i in range(a):
	(b, c, d) = map(int, input().split())
	x = b + c + d
	if x == 180:
		print('YES')
	else:
		print('NO')


t = int(input())
i = 0
while i < t:
	(a, b, c) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	if a + b + c == 180:
		print('YES')
	else:
		print('NO')
	i += 1


test = int(input())
for i in range(test):
	(a, b, c) = map(int, input().split())
	sum = a + b + c
	if sum == 180:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	a = list(map(int, input().split(' ')))
	if a[0] + a[1] + a[2] == 180:
		print('YES')
	else:
		print('NO')


test_case = int(input())
while test_case > 0:
	angle = [int(x) for x in input().split(' ')]
	if sum(angle) == 180:
		print('YES')
	else:
		print('NO')
	test_case -= 1


def triangle_valid(angle1, angle2, angle3):
	total_angle = angle1 + angle2 + angle3
	if total_angle == 180:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for i in range(t):
	(angle1, angle2, angle3) = map(int, input().split())
	print(triangle_valid(angle1, angle2, angle3))


t = int(input())
for i in range(t):
	(m, n, o) = map(int, input().split())
	if m + n + o == 180:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(b, t, s) = map(int, input().split())
	if b + t + s == 180:
		print('YES')
	else:
		print('NO')


x = int(input())
for y in range(x):
	(A, B, C) = map(int, input().split())
	f = A + B + C
	if f == 180:
		print('YES')
	else:
		print('NO')


m = int(input())
for i in range(0, m):
	l = list(map(int, input().split()))
	if l[0] + l[1] + l[2] == 180:
		print('YES')
	else:
		print('NO')


T = int(input())
while T > 0:
	(A, B, C) = map(int, input().split())
	sum = A + B + C
	if sum == 180:
		print('YES')
	else:
		print('NO')
	T = T - 1


T = int(input())
for i in range(T):
	l = [int(i) for i in input().split()]
	sum = 0
	for i in l:
		sum = sum + i
	if sum == 180:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split())
	if a > 0 and b > 0 and (c > 0) and (a + b + c == 180):
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(1, n + 1):
	(a, b, c) = [int(i) for i in input().split()]
	if a + b + c == 180:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	l = [int(i) for i in input().split()]
	if sum(l) == 180:
		print('YES')
	else:
		print('NO')


t = int(input())
while t != 0:
	(x, y, z) = [int(k) for k in input().split()]
	if x + y + z == 180:
		print('YES')
	else:
		print('NO')
	t -= 1


N = int(input())
for i in range(N):
	(a, b, c) = list(map(int, input().split()))
	if a + b + c == 180:
		print('YES')
	else:
		print('NO')


n = int(input())
while n > 0:
	a = list(map(int, input().strip().split()))
	if sum(a) == 180:
		print('YES')
	else:
		print('NO')
	n = n - 1