fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. struct Point {
  5. double x, y;
  6. };
  7.  
  8. bool kvadrant(int q, const vector<Point>& p) {
  9. for (double a = 0; a <= 1.0; a += 0.005) {
  10. for (double b = 0; b <= 1.0 - a; b += 0.005) {
  11. double c = 1.0 - a - b;
  12. double px = a * p[0].x + b * p[1].x + c * p[2].x;
  13. double py = a * p[0].y + b * p[1].y + c * p[2].y;
  14.  
  15. if (q == 1 && px > 0 && py > 0) return true;
  16. if (q == 2 && px < 0 && py > 0) return true;
  17. if (q == 3 && px < 0 && py < 0) return true;
  18. if (q == 4 && px > 0 && py < 0) return true;
  19. }
  20. }
  21. return false;
  22. }
  23.  
  24. int main() {
  25. vector<Point> points(3);
  26. for (int i = 0; i < 3; i++) {
  27. if (!(cin >> points[i].x >> points[i].y)) return 0;
  28. }
  29.  
  30. for (int q = 1; q <= 4; q++) {
  31. if (kvadrant(q, points)) cout << "+";
  32. else cout << "-";
  33. }
  34. cout << endl;
  35.  
  36. return 0;
  37. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Standard output is empty