A8156 | Young Physicist
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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 $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$ ).
输出格式
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
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted