Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:提交了20多次再加上和同学AC的代码比较终于知道陷阱在哪儿了.估计WA的都是这样.

Posted by flag at 2008-07-04 15:32:24 on Problem 1326
In Reply To:提交了20多次再加上和同学AC的代码比较终于知道陷阱在哪儿了.估计WA的都是这样. Posted by:tq at 2005-08-02 18:39:51
> 题目说小数部分四舍五入其实是每算一次就要四舍五入一次.
> 如果你用double型最后输出四舍五入的话,肯定就错了.
> 一个好的方法是这样,用int 型,然后因为计算时数据都是整数,而除也只有除2的运算
> 所以只要:tot=tot+mile+(mile+1)/2;
> 这样实现代替原来的:tot+=1.5*mile
> 就可以AC了.
> 
> 不过奇怪的是好象只有北大才会卡这种数据,因为在浙大不这样也能过.
> 郁闷~~~~

哥们儿,多谢了。我看了你的提示结果还是拿错误那个tot+=1.5*mile去wa了一次,,

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator