My code is working fine in a C++14 compiler but when I am submitting it on codechef, I get wrong answer error.
What could be the reason.
Also does codechef have a compiler where I can check my code.
I am new to codechef so not aware.
My code is working fine in a C++14 compiler but when I am submitting it on codechef, I get wrong answer error.
What could be the reason.
Also does codechef have a compiler where I can check my code.
I am new to codechef so not aware.
Goto practice --> Code Compile and Run. Check on Custom input option to run against your own small cases.
Thanks for your response.
This is my code.
using namespace std;
int main() {
int T,N,S[100],J[100],i,k,temp;
cin>>T;
if(T>=1 && T<=100)
{
for(i=0;i<T;i++)
{
cin>>N;
if(N>=1 && N<=100)
{
temp=0;
for(k=0;k<N;k++)
{
cin>>S[k];
cin>>J[k];
if(S[k]>=1 && S[k]<=300 && J[k]>=S[k] && J[k]<=300)
{
if((J[k]-S[k])>5)
{
temp++;
}
}
else cout<<“Invalid S or J input”;
}
cout<<temp;
}
else cout<<“Invalid N input”;
}
}
else cout<<“Invalid T input”;
}
where is the logic incorrect?
Tia.
may be u have not chossen langugae in codechef.