+ 3

Is there something wrong in paint cost? [SOLVED]

I am trying to solve the paint cost problem in code coach but it always fails 3rd and 5th test. Why?? Whats wrong? Please tell https://code.sololearn.com/cXNq57SaHsV0/?ref=app

22nd Dec 2019, 4:02 PM
Sarthak Gupta
Sarthak Gupta - avatar
3 Réponses
+ 10
Probably because ceil() will return a float type variable. The task asks for a int type variable. Just add an (int) before ceil() cout << (int)ceil(cost); Now it's working(tested)
22nd Dec 2019, 5:14 PM
molang
molang - avatar
+ 2
molang Thanks, it worked. Thanks a lot
22nd Dec 2019, 5:36 PM
Sarthak Gupta
Sarthak Gupta - avatar
+ 1
Thank you Molang! had the same issue
31st Dec 2019, 3:48 AM
Danyal Ahmed
Danyal Ahmed - avatar