CF69A.Young Physicist

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher got very angry at Vasya and decided to teach him a lesson. He gave the lazy student a seemingly easy task: You are given an idle body in space and the forces that affect it. The body can be considered as a material point with coordinates (0; 0; 0). Vasya had only to answer whether it is in equilibrium. "Piece of cake" — thought Vasya, we need only to check if the sum of all vectors is equal to 0. So, Vasya began to solve the problem. But later it turned out that there can be lots and lots of these forces, and Vasya can not cope without your help. Help him. Write a program that determines whether a body is idle or is moving by the given vectors of forces.

输入格式

The first line contains a positive integer nn ( 1<=n<=1001<=n<=100 ), then follow nn lines containing three integers each: the xix_{i} coordinate, the yiy_{i} coordinate and the ziz_{i} coordinate of the force vector, applied to the body ( 100<=xi,yi,zi<=100-100<=x_{i},y_{i},z_{i}<=100 ).

输出格式

Print the word "YES" if the body is in equilibrium, or the word "NO" if it is not.

输入输出样例

  • 输入#1

    3
    4 1 7
    -2 4 -1
    1 -5 -3
    

    输出#1

    NO
  • 输入#2

    3
    3 -1 7
    -5 2 -4
    2 -1 -3
    

    输出#2

    YES
首页