main.cc 571 B

123456789101112131415161718192021222324252627
  1. #include <algorithm>
  2. #include <cstdio>
  3. using namespace std;
  4. const int N = 50;
  5. struct Vector {
  6. int x;
  7. int y;
  8. Vector(int x = 0, int y = 0) : x(x), y(y) {}
  9. int operator^(const Vector &that) const {
  10. return this->x * that.y - that.x * this->y;
  11. }
  12. bool operator<(const Vector &that) const { return 0 < ((*this) ^ that); }
  13. } vec[N];
  14. int main() {
  15. int x, y, n = 0;
  16. while (scanf("%d %d", &x, &y) != EOF) {
  17. vec[n].x = x;
  18. vec[n++].y = y;
  19. }
  20. sort(vec + 1, vec + n);
  21. for (int i = 0; i < n; i++) printf("(%d,%d)\n", vec[i].x, vec[i].y);
  22. return 0;
  23. }