Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.40 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. typedef long long ll;
  4.  
  5. using namespace std;
  6.  
  7. vector <int> a1(3), a2(3);
  8.  
  9. long double c[2];
  10.  
  11. void F1(int x1, int y1, int x2, int y2) {
  12.     a1[0] = y1 - y2;
  13.     a1[1] = x2 - x1;
  14.     a1[2] = -a1[0] * x1 - a1[1] * y1;
  15. }
  16.  
  17. void F2(int x1, int y1, int x2, int y2) {
  18.     a2[0] = y1 - y2;
  19.     a2[1] = x2 - x1;
  20.     a2[2] = -a2[0] * x1 - a2[1] * y1;
  21. }
  22.  
  23. void F3() {
  24.     c[0] = -(a1[2] * a2[1] - a1[1] * a2[2]) * 1.0;
  25.     c[0] /= (a1[0] * a2[1] - a2[0] * a1[1]);
  26.     c[1] = -(a1[0] * a2[2] - a1[2] * a2[0]) * 1.0;
  27.     c[1] /= (a1[0] * a2[1] - a2[0] * a1[1]);
  28. }
  29.  
  30. int main() {
  31.     ios::sync_with_stdio(0);
  32.     cin.tie(0);
  33.     cout.tie(0);
  34.     ll n, x_0, x_1, x_2, x_3, x_4, y_1, y_2, y_3, y_4;
  35.     cin >> n >> x_0;
  36.     cin >> x_1 >> y_1 >> x_2 >> y_2 >> x_3 >> y_3 >> x_4 >> y_4;
  37.  
  38.     F1(x_1, y_1, x_2, y_2);
  39.     F2(x_3, y_3, x_4, y_4);
  40.  
  41.     F3();
  42.  
  43.     if (x_0 < 0) {
  44.         cout << "YES";
  45.         return 0;
  46.     }
  47.  
  48.     if (n * n * 1.0 / 10 < abs(x_0)) {
  49.         cout << "NO";
  50.         return 0;
  51.     }
  52.  
  53.     long double S = x_0 * 10.0 / (n * n);
  54.  
  55.     if (abs(S) >= 1) {
  56.         cout << "NO";
  57.         return 0;
  58.     }
  59.  
  60.     double ANG = max(asin(S) / 2, 3.1415926535 / 2 - asin(S) / 2);
  61.  
  62.     if (c[0] * tan(ANG) - 5.0 * c[0] * c[0] / (n * n * cos(ANG) * cos(ANG)) < c[1]) {
  63.         cout << "NO";
  64.         return 0;
  65.     }
  66.     cout << "YES";
  67.     return 0;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement