题干

time limit per test:2 seconds
memory limit per test:256 megabytes
input:standard input
output:standard output

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.

Input

The first line contains a positive integer n (1 ≤ n ≤ 100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body ( - 100 ≤ xi, yi, zi ≤ 100).

Output

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

Examples

Input

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

Output

NO

Input

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

Output

YES

分析

分别统计三列和是否为0,足够水了

代码

#include<iostream>
using namespace std;int main()
{int x = 0,y = 0,z = 0,a,b,c,n;cin >> n;while(n--){cin >> a >> b >> c;x += a;y += b;z += c;}if(x == 0 && y == 0 && z == 0)cout << "YES";elsecout << "NO";return 0;
}

Codeforeces——69A Young Physicist相关推荐

  1. 69A.Young Physicist

    69A.Young Physicist 题目 翻译 题目 输入 输出 分析 代码 题目 翻译 题目 有一位名叫Vasya高三生.一天Vasya打算看他最喜欢的曲棍球队的比赛.然而,相对物理而言他太爱曲 ...

  2. codeforces 69A. Young Physicist

    A. Young Physicist 题目链接: codeforces 69A 题意:    输入n个三维点,判断是否平衡,x轴坐标相加等于0 且 y轴坐标相加等于0 且 z轴坐标相加等于 0即为平衡 ...

  3. Codeforces Problem-69A Young Physicist

    Codeforces Problem-69A Young Physicist 基本思想: 建立vector容器,一个容器代表一列,分别用v1,v2,v3表示.将输入的数据分别存入到三个容器中,判断最后 ...

  4. codeforces 69A(Young Physicist) Java

    水题,提神专用!!! import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; ...

  5. Codeforces Young Physicist

    题目链接:http://codeforces.com/problemset/problem/69/A 题目分析:坐标求和等于0. import java.util.Scanner;class Node ...

  6. codeforces水题100道 第九题 Codeforces Beta Round #63 (Div. 2) Young Physicist (math)

    题目链接:http://www.codeforces.com/problemset/problem/69/A 题意:给你n个三维空间矢量,求这n个矢量的矢量和是否为零. C++代码: #include ...

  7. Codeforces上通过数超过5W人的题

    Codeforces上通过数超过5W人的题 共32题:1000分4题,800分28题. 编号 题号 题名 分数 通过数 1 4A Watermelon 800 x193501 2 71A Way To ...

  8. 【Codeforces】A2组刷题记录(50 / 50)完结

    目录 A1. Counterexample A2. Good Number A3. Dice Tower ★A4. Alyona and Numbers A5. Mountain Scenery rz ...

  9. 算法:详解布隆过滤器的原理、使用场景和注意事项@知乎.Young Chen

    算法:详解布隆过滤器的原理.使用场景和注意事项@知乎.Young Chen 什么是布隆过滤器 本质上布隆过滤器是一种数据结构,比较巧妙的概率型数据结构(probabilistic data struc ...

最新文章

  1. realloc函数引发的慘案
  2. 修改after样式_理解:Before和:After伪元素
  3. C#模拟post消息,实现登陆功能(包括CAS系统)
  4. android SQLite查询并显示用户输入的选择信息
  5. 重磅发布 | 承载亿级流量的开发框架,闲鱼Flutter技术解析与实战大公开
  6. Docker存储驱动之OverlayFS简介
  7. mysql if begin end_MySQL存储过程例子,不能在if else里面用begin end否则会报错Erro_MySQL...
  8. JDBC连接数据库格式
  9. OGNL与Struts2标签展示页面(一)
  10. Vue「四」—— 组件生命周期、数据共享
  11. 数据库(1)MySQL安装
  12. ionic获取手机通讯录
  13. CSS隐藏内容的三种方法比较
  14. Java:JDK、JRE和JVM的关系(图示详解,一眼就能看明白!)
  15. 关于SimpleDateFormat日期格式与字符串、时间戳之间的转换
  16. Windows部分快捷键命令/命令
  17. pandas数据处理之合并与拼接
  18. 深入理解SHA系列加密算法
  19. AppList数据处理
  20. ESXI提示 ramdisk“tmp”已满的解决方案

热门文章

  1. android图片编辑加文字,图片编辑加字安卓版
  2. 【报错】Cannot uninstall ‘certifi‘. It is a distutils installed project and thus we cannot accurately
  3. 实现内网穿透,个人电脑秒变服务器
  4. IPv4头部结构具体解释
  5. 职业综合英语 章节答案考试答案 深圳职业技术学院[渝粤教育]
  6. 入侵检测系统 FAQ
  7. 大时代、10000小时定律和徐霞客
  8. 音乐计算机曲谱狂妄之人,【B】 Undertale Sans战斗曲 MEGALOVANIA狂妄之人
  9. 使用seaborn绘制热图
  10. java LPT1_Java 未知异常 求解