Advertisement
Guest User

Untitled

a guest
Feb 28th, 2013
594
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. struct pt {
  2.     int x, y;
  3.     double value;
  4.    
  5.     inline double val() const {
  6.         return atan2(y, x);
  7.     }
  8.     inline bool operator < (const pt &p) const {
  9.         return value < p.value;
  10.     }
  11. };
  12.  
  13. const int maxn = (int)1e6;
  14. pt ps[maxn];
  15.  
  16. int main() {    
  17.     #ifdef DEBUG
  18.         freopen(TASKNAME".in", "r", stdin);
  19.         freopen(TASKNAME".out", "w", stdout);
  20.     #endif
  21.    
  22.     int n;
  23.     while (scanf("%d", &n) >= 1) {
  24.         for (int i = 0; i < n; i++) {
  25.             scanf("%d%d", &ps[i].x, &ps[i].y);
  26.             if (!ps[i].x && !ps[i].y) {
  27.                 while (1) ;
  28.             }
  29.             ps[i].value = ps[i].val();
  30.         }
  31.        
  32.         for (int i = 0; i < n; i++)
  33.             assert(ps[i].value == ps[i].val());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement