-
Notifications
You must be signed in to change notification settings - Fork 32
/
eq.cpp
46 lines (43 loc) · 806 Bytes
/
eq.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
string findEq(vector<vector<int>> forces)
{
int f[]={0,0,0};
for(int i=0;i<forces.size();i++)
{
for(int j=0;j<3;j++)
{
f[j]+=forces[i][j];
}
}
int flag=0;
for(int i=0;i<3;i++)
{
if(f[i]!=0)
{
flag=1;
break;
}
}
if(flag)
return "NO";
else
return "YES";
}
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int n;
cin>>n;
vector<vector<int>> forces(n,vector<int>(3));
for(int i=0;i<n;i++)
{
for(int j=0;j<3;j++)
cin>>forces[i][j];
}
cout<<findEq(forces);
return 0;
}