Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. using namespace std;
  5. vector <Segment> v;
  6. int n;
  7. Point kit[333];
  8. struct Point {
  9.     int x;
  10.     int y;
  11.     Point(int _x, int _y) {
  12.         x = _x;
  13.         y = _y;
  14.     }
  15.     Point() {}
  16.     bool operator ==(Point G) {
  17.         if (G.x == x&&G.y == y) return 1;
  18.         else return 0;
  19.     }
  20.     bool operator !=(Point G) {
  21.         if (G.x != x || G.y != y) return 1;
  22.         else return 0;
  23.     }
  24. };
  25. struct Segment {
  26.     Point a;
  27.     Point b;
  28.     int numbering = 0;
  29.     Segment() {}
  30.     Segment(Point _a, Point _b) {
  31.         a = _a;
  32.         b = _b;
  33.     }
  34. };
  35. bool comparator(Point a, Point b) {
  36.     return a.x < b.x;
  37. }
  38.  
  39. istream& operator >> (istream& cin, Point &A) {
  40.     cin >> A.x >> A.y;
  41.     return cin;
  42. }
  43. ostream& operator << (ostream& cin, Point &A) {
  44.     cin << A.x << ' ' << A.y << endl;
  45.     return cin;
  46. }
  47. void read_out() {
  48.     for (int i = 0; i < n; i++) {
  49.         for (int j = i + 1; j < n; j++) {
  50.             v.a.push_back(kit[i]);
  51.             v.b.push_back(kit[j]);
  52.         }
  53.     }
  54. }
  55. void under_the_cut() {
  56.     for (int i = 0; i < v.size(); i++) {
  57.         co = 0;
  58.         for (int j = 0; j < n; j++) {
  59.             if ((Segment[i].a.x < kit[j].x && kit[j].x < Segment[i].b.x) || (Segment[i].a.x > kit[j].x && kit[j].x > Segment[i].b.x)) {
  60.                 Segment[i].numbering++;
  61.             }
  62.         }
  63.     }
  64. }
  65. int main() {
  66.     cin >> n;
  67.     for (int i = 0; i < n; i++)cin >> kit[i];
  68.     read_out();
  69.  
  70.     return 0;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement