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 267400433 at 2006-04-23 14:50:01 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了.
> 
> 不过奇怪的是好象只有北大才会卡这种数据,因为在浙大不这样也能过.
> 郁闷~~~~

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