fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. typedef vector<int> vi;
  5. typedef pair <int, int> ii;
  6. typedef pair <ll, int> li;
  7. #define mk make_pair
  8.  
  9. struct point
  10. {
  11. double x, y;
  12. };
  13.  
  14. point a, b, c, m;
  15.  
  16. double cc1(point a, point b)
  17. {
  18. double a1 = max(a.x, b.x) - min(a.x, b.x);
  19. double b1 = max(a.y, b.y) - min(a.y, b.y);
  20. double ans = a1 * a1 + b1 * b1;
  21. return sqrt(ans);
  22. }
  23.  
  24. double cc2(double a, double b, double c)
  25. {
  26. double p = (double) (a + b + c) / 2.0;
  27. double ans = p * (p - a) * (p - b) * (p - c);
  28. return (ans > 0) ? sqrt(ans) : 0;
  29. }
  30.  
  31.  
  32. int main()
  33. {
  34. ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  35.  
  36. #define file "TAMGIAC"
  37. freopen(file".INP", "r", stdin);
  38. freopen(file".OUT", "w", stdout);
  39.  
  40. cin >> a.x >> a.y;
  41. cin >> b.x >> b.y;
  42. cin >> c.x >> c.y;
  43. cin >> m.x >> m.y;
  44.  
  45. //tinh canh
  46. double ab = cc1(a, b);
  47. double ac = cc1(a, c);
  48. double bc = cc1(b, c);
  49. double ma = cc1(m, a);
  50. double mb = cc1(m, b);
  51. double mc = cc1(m, c);
  52.  
  53. // tinh dien tich
  54.  
  55. double sabc = cc2(ab, ac, bc);
  56. double smab = cc2(ab, ma, mb);
  57. double smac = cc2(ac, ma, mc);
  58. double smbc = cc2(bc, mb, mc);
  59.  
  60. cout << (abs((smab + smac + smbc) - sabc) <= 1e-4);
  61.  
  62.  
  63. return 0;
  64. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Standard output is empty