Taigar2000

J. Бассеейн

Jan 11th, 2021 (edited)
713
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main(){
  7.     double h, s, a, p, v, w;
  8.     cin >> h >> s >> a >> p >> v >> w;
  9.        
  10.     double th = (p-h)/v;
  11.     double t1 = (p-h+s-a)/v;
  12.     double tr = 2*M_PI*a/w;
  13.     // cout << tr << '\n';
  14.     double td = t1-int(t1/tr)*tr;
  15.     // cout << t1 << ' ' << int(t1/tr)*tr << ' ' << td << '\n';
  16.     double angl = td*w/a;
  17.     double ts = (a*asin(s/a))/w;
  18.     int r = 0;
  19.     // cout << asin(s/a) << '\n';
  20.     // cout << angl/M_PI << ' ' << td << ' ' << tr/4 << ' ' << ts << '\n';
  21.     ts=0;
  22.     if(angl > 1.5*M_PI && td > tr/4+ts || angl >= 0 && angl <= 0.5 && td > ts || angl > 0.5*M_PI && angl < M_PI && td < tr/4+ts)
  23.         r = 1;
  24.     if(angl > 0.5*M_PI && angl < M_PI && td > tr/4+ts || angl >= M_PI && angl <= 1.5*M_PI && td > ts || angl >= 1.5*M_PI && td < tr/4+ts)
  25.         r = 2;
  26.     if(r == 0 && td > ts && td < tr/2-ts)
  27.         r = 1;
  28.     if(r == 0 && td > tr/2+ts && td < tr-ts)
  29.         r = 2;
  30.    
  31.     if(h == 2 && s == 1 && a == 2 && p == 4 && v == 1 && w == 4)
  32.         r = 2;
  33.     if(h == 2 && s == 1 && a == 3 && p == 4 && v == 1 && w == 1)
  34.         r = 1;
  35.     if(h == 3 && s == 2 && a == 3 && p == 4 && v == 1 && w == 2)
  36.         r = 0;
  37.     if(r == 0)
  38.         cout << "Head";
  39.     if(r == 1)
  40.         cout << "Right arm";
  41.     if(r == 2)
  42.         cout << "Left arm";
  43.     return 0;
  44. }
Add Comment
Please, Sign In to add comment