How do I unhide test cases? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I unhide test cases?

I'm trying to do the Halloween Candy challenge. 2 passed but 3 test cases failed but I can't see the cases. Is there a way to unhide them?

16th Jan 2020, 12:15 AM
c0dezer019
c0dezer019 - avatar
7 Answers
+ 8
Brian i think the problem is in the format of your output .Math.ceil returns a double value. So you have to change double value to integer you can do it by placing (int) before the value or you can also use formatter just like this import java.util.Scanner; import java.text.*; class Program { public static void main(String[] args) { Scanner input = new Scanner(System.in); double houses = input.nextDouble(); if(houses < 2) { System.out.println("You didn't visit enough houses"); } else { double chance = (2/houses)*100; DecimalFormat df=new DecimalFormat("#"); System.out.println(df.format(Math.ceil(chance))); } } }
16th Jan 2020, 2:25 PM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar
+ 7
If you can see the inputs and expected outputs, you could hard code the answers and never solve the problem. If you post your code here, those of us that have solved it can help you fix it.
16th Jan 2020, 12:30 AM
John Wells
John Wells - avatar
+ 7
Just try and try until your problem become solved. And don't hesitate to ask question in Q&A it don't make anyone smaller. Community are always there to help everyone.
16th Jan 2020, 1:37 PM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar
+ 4
No.
16th Jan 2020, 12:16 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
The only thing that has come close to solving was using Math.round() but when I searched everyone has been saying to use ceil(). https://code.sololearn.com/c7rvh3cqanh6/?ref=app
16th Jan 2020, 2:10 PM
c0dezer019
c0dezer019 - avatar
+ 1
0_0 Mägár Sám Äkà Nüllpøïntêr Èxëcéptïön Thanks, placing (int) did the trick!
16th Jan 2020, 2:50 PM
c0dezer019
c0dezer019 - avatar
+ 1
The whole idea behind hidden cases is to prevent people from hard coding all answers.
17th Jan 2020, 11:55 PM
inxanedev!
inxanedev! - avatar