codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

69A.md (1686B)


      1 Source: https://codeforces.com/problemset/problem/69/A
      2 
      3 A. Young Physicist
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 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.
     22 
     23 Input
     24 
     25 The first line contains a positive integer *n* (1 ≤ *n* ≤ 100), then follow *n* lines containing three integers each: the *x**i* coordinate, the *y**i* coordinate and the *z**i* coordinate of the force vector, applied to the body ( - 100 ≤ *x**i*, *y**i*, *z**i* ≤ 100).
     26 
     27 Output
     28 
     29 Print the word "YES" if the body is in equilibrium, or the word "NO" if it is not.
     30 
     31 Examples
     32 
     33 Input
     34 
     35 ```
     36 3  
     37 4 1 7  
     38 -2 4 -1  
     39 1 -5 -3
     40 ```
     41 
     42 Output
     43 
     44 ```
     45 NO
     46 ```
     47 
     48 Input
     49 
     50 ```
     51 3  
     52 3 -1 7  
     53 -5 2 -4  
     54 2 -1 -3
     55 ```
     56 
     57 Output
     58 
     59 ```
     60 YES
     61 ```