CF69A.Young Physicist

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

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.

一个名叫瓦西娅的男孩正在上高中的毕业年级。一天,瓦西娅决定观看他最喜爱的冰球队的比赛。由于这个男孩非常热爱冰球——甚至比物理还要热爱——他忘记完成家庭作业,具体来说,就是没做完物理作业。第二天,老师对瓦西娅非常生气,决定给他一个教训。老师给了这位懒惰的学生一道看似简单的题目:“空间中有一个静止的物体,以及作用在它上面的若干力。该物体可视为位于坐标 (0;0;0)(0; 0; 0) 处的一个质点。瓦西娅只需判断该物体是否处于平衡状态。”
“小菜一碟!”瓦西娅心想,我们只需检验所有力矢量的矢量和是否为零即可。于是瓦西娅开始解题。但后来发现,这些力的数量可能非常多,瓦西娅无法独立完成,急需你的帮助。请编写一个程序,根据给定的力矢量,判断该物体是保持静止还是正在运动。

输入格式

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).

第一行包含一个正整数 nn(1≤n≤1001 \leq n \leq 100),随后的 nn 行每行包含三个整数:作用在物体上的力向量的 xix_i 坐标、yiy_i 坐标和 ziz_i 坐标(−100≤xi,yi,zi≤100-100 \leq x_i, y_i, z_i \leq 100)。

输出格式

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

如果物体处于平衡状态,则输出单词 “YES”;否则输出单词 “NO”。

输入输出样例

  • 输入#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

输入解题思路,AI测评打分。不知道怎么写?

首页