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

精度问题=,=

Posted by 201092343 at 2012-09-20 14:49:46 on Problem 2333
变量定义成double会有精度问题,换成long long。
dis函数求距离的平方,避免精度。
long long ans;
cout<<ans/2.0<<endl;
这么写也会WA;
最后换成
long long ans;
if(ans%2==0) cout<<ans/2<<endl;
else cout<<ans/2<<".5"<<endl;
才过了=,=

蛋疼的精度问题

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