fork download
  1. #include<iostream>
  2. #include<cmath>
  3. #include<cstdio>
  4.  
  5. using namespace std;
  6.  
  7. struct pt {
  8. double x, y;
  9. pt(double x, double y) : x(x), y(y) {}
  10. };
  11.  
  12. void rotate(pt &p, double angle) {
  13. double cosA = cos(angle), sinA = sin(angle);
  14. p = pt(p.x*cosA-p.y*sinA , p.x*sinA+p.y*cosA);
  15. }
  16.  
  17. bool eq(double a, double b) {
  18. return fabs(a-b) < 1e-9;
  19. }
  20.  
  21. int main() {
  22. int t; cin >> t;
  23. for(int i = 0; i < t; i++) {
  24. int a; cin >> a;
  25. double angle = (180-a)/180.*acos(-1);
  26. pt v(1,0);
  27. bool ok = false, r = false;
  28. for(int j = 0; j < 360; j++) {
  29. rotate(v, angle);
  30. if(eq(v.x,1) && eq(v.y,0)) {
  31. ok = true;
  32. break;
  33. }
  34. if(v.y < 0) {
  35. r = true;
  36. }
  37. if(r && v.y > 0) {
  38. break;
  39. }
  40. }
  41. cout << (ok?"YES":"NO") << endl;
  42. }
  43. }
  44.  
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
Standard output is empty