Untitled

 avatar
user_5668965
c_cpp
a year ago
543 B
14
Indexable
#include<bits/stdc++.h>
using namespace std;
int n,i=0,sum=0;
vector<int> v;
bool ok=false;
void check(int i,int sum)
{
    if(i==n)
    {
        if(sum%360==0)
            ok=true;
        return ;
    }
    check(i+1,sum+v[i]);
    check(i+1,sum-v[i]);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int x;
    cin>>n;
    for(int j=0;j<n;j++){
        cin>>x;
        v.push_back(x);
    }
    check(i,sum);
    (ok)?cout<<"YES":cout<<"NO";
    return 0;
}
Editor is loading...
Leave a Comment