[2016-03-22][CF][69A][Young Physicist]
时间:2016-03-22 19:41:34 星期二
题目编号:[2016-03-22][CF][69A][Young Physicist]
题目大意:判断向量和是否为0
分析:对应坐标相加
遇到的问题:不能用
x+y+z来判断是否都为0,除非输入都是正数
#include <cstdio>using namespace std;int main(){int a,b,c,x,y,z,n;x = y = z = 0;scanf("%d",&n);for(int i = 0; i < n ;++i){scanf("%d%d%d",&a,&b,&c);x += a;y += b;z += c;}puts((x || y || z ? "NO":"YES"));return 0;}
浙公网安备 33010602011771号