|
|
вернуться в форумTo 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... Послано LSBG 29 апр 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... Послано ASK 6 мар 2010 17:33 You are absolutely right: ``cout << int(r)'' is WA, while ``printf("Distance is %.0lf km.", r);'' is AC. |
|
|