ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1820. Ural Steaks

Why two equal Java codes give different results? (test #13)
Posted by Ivan Avdonin (Vologda ML) 3 Aug 2015 07:09
First code gives wrong answer test #13. In the next code I changed

   System.out.print(2*n/k+2*n%k);

and used Math.ceil()

   System.out.print((int)Math.ceil(2*(float)n/(float)k));

The code was accepted. What's wrong?

Edited by author 03.08.2015 07:16

Edited by author 03.08.2015 07:17

Edited by author 03.08.2015 07:17

Edited by author 03.08.2015 07:17

Edited by author 03.08.2015 07:18

Edited by author 03.08.2015 07:18

Edited by author 03.08.2015 07:22