Please help me in code coach problem: paint cost | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please help me in code coach problem: paint cost

https://code.sololearn.com/cGM7GMdyT010/?ref=app

19th Apr 2020, 7:21 AM
Vinayak Dutt
Vinayak Dutt - avatar
2 Answers
0
Buying an odd amount of colours will fail because integer division/ storing the result in an integer will cut off the .5 part, e.g. 1 -> 45 / 10 = 4 3 -> 55 / 10 = 5 so rounding it afterwards has no effect. Also, I would prefer std::ceil() over std::rint() when it comes to rounding a number up.
19th Apr 2020, 7:36 AM
Shadow
Shadow - avatar
0
Thanks @Shadow
19th Apr 2020, 7:43 AM
Vinayak Dutt
Vinayak Dutt - avatar