0

Why the code challenge solution is failing for test 3 and 5 UN-SOLVED

The question is : You are getting ready to paint a piece of art. The canvas and brushes that you want to use will cost 40.00. Each color of paint that you buy is an additional 5.00. Determine how much money you will need based on the number of colors that you want to buy if tax at this store is 10%. Task Given the total number of colors of paint that you need, calculate and output the total cost of your project rounded up to the nearest whole number. Input Format An integer that represents the number of colors that you want to purchase for your project. Output Format A number that represents the cost of your purchase rounded up to the nearest whole number. Sample Input 10 Sample Output 99 https://code.sololearn.com/cQ1CPYnnIUMT/?ref=app

27th Apr 2020, 11:24 AM
destroyer
destroyer - avatar
11 Respostas
+ 2
Hidden test cases 3 and 5: //were standing here, but are secret(because they are hidden) They are just too big for floats and doubles....
27th Apr 2020, 1:59 PM
Alexander Thiem
Alexander Thiem - avatar
+ 1
maybe check before if a is even, and if a is even just save the result to an int. otherwise you also save the result in an int and than check whether you have to add 1......
27th Apr 2020, 2:18 PM
Alexander Thiem
Alexander Thiem - avatar
+ 1
or just use Lybrarys for round... they can probably deal with it....
27th Apr 2020, 2:31 PM
Alexander Thiem
Alexander Thiem - avatar
0
There is no error and its giving the correct output if I am not wrong ,well what error are you getting?
27th Apr 2020, 11:33 AM
Abhay
Abhay - avatar
0
This might be wierd but I don't know about the error I'm getting. This code was for the sololearn quiz https://www.sololearn.com/coach/22?ref=app And it shows test case #3 and #5 failed, which are internal ones, not shown
27th Apr 2020, 11:36 AM
destroyer
destroyer - avatar
0
I even tested for odd values like 33 and 133 ,and the answer is right ,maybe someone else knows other values or maybe your method of doing it is wrong ,I am not sure ,I would recommend to rephrase your question as why the code challenge solution is failing for test 3 and 5 and put UN-SOLVED after it to get more responses
27th Apr 2020, 12:20 PM
Abhay
Abhay - avatar
0
Because it's in the rules for rounding off that if the number before 5 is even, you subtract, and if it is odd, you add http://academic.brooklyn.cuny.edu/geology/leveson/core/linksa/roundoff.html
27th Apr 2020, 1:21 PM
destroyer
destroyer - avatar
0
Also, I just tried your approach and it still fails for test 3 and 5
27th Apr 2020, 1:24 PM
destroyer
destroyer - avatar
0
Then what do I do to solve it?
27th Apr 2020, 2:16 PM
destroyer
destroyer - avatar
29th Apr 2020, 11:27 AM
Nikhil Maroju
Nikhil Maroju - avatar