View Code of Problem 6

#include<stdio.h>
int main(){
  int i,t,n,a[100][2],h,max;
  scanf("%d",&t);
  while(t--){
    scanf("%d",&n);
    for(i=0;i<n;i++)
      scanf("%d",&a[i][0],&a[i][1]);
    max=a[0][1]-a[0][0];
    for(i=1;i<n;i++){
      h=a[i][1]-a[i][0];
      if(max>=h)  max=h;
      else{
        printf("No");
        break;
      }
    } 
    if(i>=n)
      printf("Yes");
    return 0;
  }
      
    
    
/*
Main.c: In function 'main':
Main.c:8:7: warning: too many arguments for format [-Wformat-extra-args]
       scanf("%d",&a[i][0],&a[i][1]);
       ^
Main.c:21:3: error: expected declaration or statement at end of input
   }
   ^
*/

Double click to view unformatted code.


Back to problem 6