|
|
back to boardTo all C++ coders having problems with T#3 or so... In this problem,rounding the double value to the nearest integer appeares to be the most tricky part of the whole problem. If you want to guarantee correct rounding, do it yourself with floor() and ceil(). At least,as it happened to me.:) Re: To all C++ coders having problems with T#3 or so... Posted by LSBG 29 Apr 2008 16:28 You can do it like this: printf("%.0lf\n", res); Re: To all C++ coders having problems with T#3 or so... Posted by ASK 6 Mar 2010 17:33 You are absolutely right: ``cout << int(r)'' is WA, while ``printf("Distance is %.0lf km.", r);'' is AC. |
|
|