Advertisement
Infernale

Point

Jan 13th, 2019
453
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.57 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int one, two, three, four;
  4.  
  5. int max(int a, int b){
  6.     return a>=b?a:b;
  7. }
  8.  
  9. void checkQuadrant(int x, int y){
  10.     if(x>0 && y>0){
  11.         one++;
  12.     }else if(x<0 && y>0){
  13.         two++;
  14.     }else if(x<0 && y<0){
  15.         three++;
  16.     }else if(x>0 && y<0){
  17.         four++;
  18.     }
  19. }
  20.  
  21. int main(){
  22.     int tc, x, y, n;
  23.     scanf("%d", &tc);
  24.     for(int i=1;i<=tc;i++){
  25.         one=two=three=four=0;
  26.         scanf("%d", &n);
  27.         for(int j=0;j<n;j++){
  28.             scanf("%d %d", &x, &y);
  29.             checkQuadrant(x, y);
  30.         }
  31.         printf("Case #%d: %s\n", i, n-max(one,max(two,max(three,four)))>1?"NO":"YES");
  32.     }
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement