Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

why getting wrong answer in the lead game

$
0
0

include<stdio.h>

int main() { int n,i,si,ti,w,m=0,l; scanf("%d",&n);

for(i=1;i<=n;i++)
   {  scanf("%d %d",&si,&ti);

       if(si>ti)
      { l=si-ti;
       if(l>m)

{m=l; w=1;}

        }
        else{
            l=ti-si;
            if(l>m)
            {m=l;
            w=2;
        }
        }   
    }
    printf("%d %d",w,m);
    return 0;
}

Viewing all articles
Browse latest Browse all 39796

Trending Articles