fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. struct point {
  6. double x, y;
  7. };
  8.  
  9. struct point get() {
  10. struct point a;
  11. cin >> a.x >> a.y;
  12. return a;
  13. }
  14.  
  15. double location(struct point a, struct point b, struct point d) {
  16. return (d.x - a.x) * (b.y - a.y) - (d.y - a.y) * (b.x - a.x);
  17. }
  18.  
  19. // Лежат ли точки C и D с одной стороны прямой (AB)?
  20. bool f(struct point a, struct point b, struct point c, struct point d)
  21. {
  22. return g(a, b, c) * g(a, b, d) >= 0;
  23. }
  24.  
  25. int main()
  26. {
  27. struct point a = get(), b = get(), c = get(), d = get();
  28. printf( f(a,b,c,d) && f(b,c,a,d) && f(c,a,b,d) ? "yes" : "no");
  29. return 0;
  30. }
Success #stdin #stdout 0s 3464KB
stdin
0 0 1 1 1 0 0 0
stdout
Standard output is empty