codeforces young physicist solution dorhubs code example

Example: young physicist codeforces

#include <bits/stdc++.h>using namespace std;#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)#define ll long long#define fi first#define se second#define mp make_pair#define pb push_back#define eb emplace_backll gcd(ll a,ll b){    if(a==0)        return b;    else        return gcd(b%a,a);}ll findGCD(vector<ll> arr,ll n) {     ll result = arr[0];     for (ll i = 1; i < n; i++)         result = gcd(arr[i], result);    return result; }int main() {    SPEED;    cout.precision(8);    cout << fixed;    ll t;    cin>>t;    ll sum=0;    ll sx=0;    ll sy=0;    ll sz=0;    for(ll i=0;i<t;i++){        ll tx,ty,tz;        cin>>tx>>ty>>tz;        sx+=tx;        sy+=ty;        sz+=tz;    }    if(sx==0 && sy==0 && sz==0) cout<<"YES";    else cout<<"NO";    return 0;}

Tags:

Cpp Example