Untitled
raw download clone
TEXT
views 36
,
size 783 b
#include <bits/stdc++.h>

using namespace std;
 

int ok = 0;
void trying_all_possibilities(int n ,int x[],int sum){
if(n==0&&sum%360==0){

        ok = 1;}
if(n==0){
    return;
}
        n--;
//cout<<sum<<endl;
    trying_all_possibilities(n,x,sum+x[n]);
    trying_all_possibilities(n,x,sum-x[n]);
}

 int main(){
   ios_base::sync_with_stdio(0);cin.tie(NULL);
            int n ;
            cin>>n;
            int x[n];
            for(int i = 0;i<n;++i){
                cin>>x[i];
            }
            trying_all_possibilities(n,x,0);
                    if(ok){
                        cout<<"YES"<<endl;
                    }
                    else{
                        cout<<"NO"<<endl;
                    }
    return 0;
}
close fullscreen
Login or Register to edit or fork this paste. It's free.