When I am running my code in CodeChef’s online IDE, the output I am getting for each test case is correct but while submitting the code I am getting “wrong answer” message. Can anyone help me out plz?
Its because there are other cases where your code might fail
For example if question is to print square of input and test cases are
2
OUTPUT: 4
5
OUTPUT: 25
Even this code passes your sample test case
void solve(){
int n;
cin >> n;
if(n == 2)cout << 4 << endl;
if(n == 5) cout << 25 << endl;
}
But this code is not right to pass all the test cases.
1 Like