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

遇到浮点数 G++WA C++AC 在我这里已经成公理了... 一直不知道为什么...

Posted by bobobo at 2009-11-11 04:34:11 on Problem 3625
In Reply To:想说几点 Posted by:spracle_hao at 2009-05-26 14:19:43
> 1. 我也是c++ AC,g++ WA,难道两者处理浮点数方面有讲究??
> 
> 2. 关于坐标读入问题:用int完全可以,只不过计算距离时有:d=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)),(x1-x2)(or(y1-y2))达10^6,平方后10^12,显然超出了int范围,正确的处理方法:d=sqrt(1.0(x1-x2)*(x1-x2)+1.0*(y1-y2)*(y1-y2))
> 
> 3.题目说了“without rounding”,也就是说不存在四舍五入,那为什么反而("%.2f",ans)AC,而("%.2f",((int)(ans*100))/100.0)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