01.17B

01.17B
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
问题链接:https://vjudge.net/contest/277768#problem/B
问题代码:

#include<iostream>
using namespace std;
int main()
{
	int n; cin >> n;
	int x[1000], y[1000], z[1000], sum1 = 0, sum2 = 0, sum3 = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> x [i]>> y [i]>> z[i];
	}
	for (int j = 0; j < n ; j++)
	{
		sum1 = sum1 + x[j];
		sum2 = sum2 + y[j];
		sum3 = sum3 + z[j];
	}
	if (sum1== 0 && sum2== 0 && sum3== 0)
	{
		cout << "YES" << endl;
	}
	else { cout << "NO" << endl; }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
当你想要查询Linux系统CPU状态时,可以使用top命令。Top命令可以显示系统当前的进程信息以及资源占用情况,其中包括CPU占用情况。 以下是一个简单的脚本,使用top命令查询CPU状态并输出到终端: ``` #!/bin/bash while true do clear top -b -n 1 | head -n 20 sleep 1 done ``` 这个脚本会循环执行top命令,每秒钟更新一次CPU状态信息。执行脚本后,你可以在终端上看到类似下面的输出: ``` top - 12:45:15 up 5 min, 1 user, load average: 0.74, 0.47, 0.24 Tasks: 211 total, 1 running, 210 sleeping, 0 stopped, 0 zombie %Cpu(s): 25.3 us, 4.3 sy, 0.0 ni, 70.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 2048000 total, 151664 free, 272236 used, 1629100 buff/cache KiB Swap: 1048572 total, 1048572 free, 0 used. 1496540 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 4054 user 20 0 112548 5764 3208 R 16.7 0.3 0:00.02 top 1 root 20 0 225280 6356 3876 S 0.0 0.3 0:01.17 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:00.02 ksoftirqd/0 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:+ 7 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0 8 root RT 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh 9 root RT 0 0 0 0 S 0.0 0.0 0:00.00 rcu_sched 10 root 20 0 0 0 0 S 0.0 0.0 0:00.00 lru-add-dr+ 11 root 20 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0 12 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/0 13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/1 14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs 15 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns ``` 其中,%Cpu(s)行显示了CPU的占用情况,包括用户态进程占用时间(us)、系统态进程占用时间(sy)、空闲时间(id)等。PID、COMMAND等列则显示了当前正在运行的进程信息。 你可以按q键退出top命令并停止脚本的执行。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值