0
What seems to be the issue here 🤔, #hidden (locked) testcases in Fruitbowl
The hidden test cases are the ones that won't allow this fruit = int(input()) if(fruit>=0): if(fruit%2==0): apple=fruit//2 print(apple//3)
3 Réponses
+ 1
Yes question have to be changed(it said only even inputs)but ,it gives odd inputs also.(A MISTAKE)
you can confirm by place != operator instead of == operator you will find hidden test cases pass and 1 and 2 will fail.
so input can be anything odd or even , so don't check for only even inputs
0
Hi N J!
It gives no output for positive odd numbers because of your second if statement. For that, you can remove that statement or comment it.
So, your code needs to be like this
fruit = int(input())
if(fruit>=0):
#if(fruit%2==0):
apple=fruit//2
print(apple//3)
0
include <iostream>
using namespace std;
int main() {
int fruit;
cin>>fruit;
int pie;
for (int i=0; i<= fruit/2; i+=3){
if (i ==0){
continue ;
}
pie++;
}
cout << pie;
return 0;
}