Advertisement
erfanul007

CF 2019 B

Jan 4th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #include<cmath>
  3. using namespace std;
  4. int main()
  5. {
  6. int n,w[30],i,j;
  7. int total=0,ps,temto,diff;
  8. scanf("%d",&n);
  9. for(i=0;i<n;i++){
  10. scanf("%d",&w[i]);
  11. total=total+w[i];
  12. }
  13. ps=pow(2,n);
  14. for(i=0;i<ps-1;i++){
  15. temto=0;
  16. for(j=0;j<n;j++){
  17. if(i&(1<<j)){
  18. temto=temto+w[j];
  19. }
  20. }
  21. diff=total-temto;
  22. diff=abs(temto-diff);
  23. if(diff%360==0){
  24. printf("YES\n");
  25. return 0;
  26. }
  27. }
  28. printf("NO\n");
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement