leadgame..its correct yet wron answer,,plz point out whats wrong

#include
using namespace std;
int main()
{
int n,s1,t1,temp=0,temp1,high,highest=0,i;
cout<<“Enter number of rounds: “;
cin>>n;
if(n>10000)
return 1;
cout<<”\n Enter the scores for each round: \n”;
cout<<"s1 "<<“t1\n”;
for(i=0;i<n;i++)
{
cin>>s1>>t1;

	if(s1>t1)
	{
		high=s1;
		temp=s1-t1;
	
	
	}
	else
	{
		high=t1;
		temp=t1-s1;
	}	
	if(highest<temp)
	{
		temp1=i+1;
		highest=temp;
	}
}
cout<<temp1<<" "<<highest<<"\n";
return 0;

}

I can’t understand this part of your code

 for(i=0;i<n;i++) {="" cin="">>s1>>t1;

Please enter the proper code.

A common mistake many people make is that they only go for the lead of that single round. You must check for the net cummulative lead.

Also there’s no need for any “Enter number of rounds, Enter the scores for each round:”.

There is no need to check if n>10000 as it is given in the question that it will be lesser.

Try looking at a few solutions to understand what all you need and what all you don’t need.

1 Like