Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.34 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3. #include <iostream>
  4. #include <cstdio>
  5. #include <iomanip>
  6. #include <string>
  7. #include <vector>
  8. #include <map>
  9. #include <set>
  10. #include <stack>
  11. #include <queue>
  12. #include <algorithm>
  13. #include <cmath>
  14.  
  15. typedef long long ll;
  16.  
  17. using namespace std;
  18. void intersect(double a1, double a2, double b1, double b2, double c1, double c2, double& x, double& y)
  19. {
  20.     double det = a1 * b2 - a2 * b1;
  21.     x = (b1 * c2 - b2 * c1) / det;
  22.     y = (a2 * c1 - a1 * c2) / det;
  23. }
  24.  
  25.  
  26.  
  27. int main(){
  28.     long double g = 10;
  29.     long double k1,k2, a, y1, y2, y3, y4, x1, x2, x3, x4;
  30.     long double x0, v,alth,a1,a2,b1,b2,c1,c2;
  31.     cin >> v>> x0;
  32.     cin >> x1 >> y1 >> x2 >> y2;
  33.     cin >> x3 >> y3 >> x4 >> y4;
  34.     alth = (asinl((x0 * 10) / (v*v))/2)*(180 / 3.14159265);
  35.     if (alth < 45) {
  36.         alth = 90 - alth;
  37.     }
  38.     double X, Y;
  39.     a1 = y1 - y2;
  40.     b1 = x2 - x1;
  41.     c1 = x1 * y2 - x2 * y1;
  42.     a2 = y3 - y4;
  43.     b2 = x4 - x3;
  44.     c2 = x3 * y4 - x4 * y3;
  45.  
  46.     intersect(a1, a2, b1, b2, c1, c2, X, Y);
  47.    
  48.     //cout << b1;
  49.     if ((v*v) / ( g) < abs(x0)) {
  50.         cout << "No";
  51.     }
  52.     else {
  53.        
  54.         if (X < 0||X>x0) {
  55.             cout << "Yes";
  56.         }
  57.         else {
  58.             if ((((-g) / (2 * v*v*cosl(alth*3.14159265 / 180.0)*cos(alth*3.14159265 / 180.0)))*X*X) + (tanl(alth*3.14159265 / 180.0)*X) <= Y) {
  59.                 cout << "No";
  60.             }
  61.             else {
  62.                 cout << "Yes";
  63.             }
  64.         }
  65.  
  66.     }
  67.     //system("pause");
  68.    
  69.     return 0;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement