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 aoxboxcox at 2009-06-22 12:55:11 on Problem 1131 and last updated at 2009-06-22 20:01:20
In Reply To:我有一段AC的代码,但是不知道代码的解题思路是什么,有劳牛人解释一下,谢了 Posted by:Lone_mover at 2008-08-14 14:40:23
还以0.123为例
初始时:       0[8]=0[10]
两边加上3[8]: 3[8]=3[10]
两边除以8[10]:0.3[8]=0.375[10]
两边加上2[8]: 2.3[8]=2.375[10]
两边除以8[10]:0.23[8]=0.296875[10]
两边加上1[8]: 1.23[8]=1.296875[10]
两边除以8[10]:0.123[8]=0.162109375[10]

myDivide里做的事情就是对a[]除以8。
主函数里对a[0]的赋值相当于在个位数上做加法。
算法巧妙地利用了个位数上8进制数等于10进制数,匠心独具,赞一个。

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