Why am i getting a WA for this problem? (CHOPRT Problem - CodeChef)
My Code Is:-
#include
using namespace std;
int main(){
int t;
cin>>t;
while(t–){
long a,b;
cin>>a>>b;
if(a>b){
cout<<“≻”<<endl;
}
if(a<b){
cout<<“≺”<<endl;
}
if(a==b){
cout<<“=”<<endl;
}
}
return 0;
}
Looking at some of the accepted solutions, it looks like people are using
<
and >
,
instead of the stranger symbols
≺
, ≻
used in the problem description and sample input - have you tried that?
Edit:
@vijju123 - is it possible to get the problem description for this changed? At the very least, the “Output” section should be using <
and >
instead of ≺
and ≻
, I think.
#include
using namespace std;
int main()
{
int t;
cin>>t;
while(t–)
{
long a,b;
cin>>a>>b;
if(a>b)
{
cout<<">"<<endl;
}
if(a<b)
{
cout<<"<"<<endl;
}
if(a==b)
{
cout<<"="<<endl;
}
}
return 0;
}
Try this one may be it will work tell me if it works or not.
And please do not ask these questions if u are a beginner instead of that try to debug your code by your self this will help u a lot (personal experience).
Fair point. I will discuss it with admin and do the needful if he approves!
Your corrected code-
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t–){
long a,b;
cin>>a>>b;
if(a>b){
cout<<">"<<endl;
}
if(a<b){
cout<<"<"<<endl;
}
if(a==b){
cout<<"="<<endl;
}
}
return 0;
}
The issue is with > and < and not with your code.
Hi,
The statement is updated. Thanks for suggesting that!
Gosh, that was quick - thanks!