#include<stdio.h>
int main()
{
int n,w,l=0;
scanf("%d",&n);
if(n<=100000)
{
int s,t;
while(n–)
{
scanf("%d%d",&s,&t);
if(s>=1&&s<=1000&&t>=1&&t<=1000)
{
if(s>t)
{
if(l<(s-t))
{
w=1;
l=s-t;
}
}
else
{
if(l<(t-s))
{
w=2;
l=t-s;
}
}
}
}
printf("%d\t%d",w,l);
}
return 0;
}
plzz tell what is wrong in this
Hello, You should change printf("%d\t%d",w,l); to printf("%d %d",w,l);i.e there should be a single space instead of tab.And also your code output is wrong for :
4
7 5
9 10
4 9
3 5
Answer : 2 6
But your output : 2 5
I hope you can debug now.
Best,
Chaitanya
why it should be 2 6 when the highest lead is 9-4=5