竹園論壇

標題: [數學]1026 - 惡猿果實 [打印本頁]

作者: Shaymin    時間: 2014-9-25 20:29
標題: [數學]1026 - 惡猿果實
本帖最後由 Shaymin 於 2014-9-25 22:30 編輯

原題:http://tioj.ck.tp.edu.tw/problems/1026
測試結果:http://tioj.ck.tp.edu.tw/submissions/2758

本人使用強大的觀察法找到了規律,解說如下:
參考表
ND距離dist方法
1X
1
1
20
3
+1+2
30
5
-1+2+4
41
7
+1+2+4
50
9
-1-2+4+8
61
11
+1-2+4+8
72
13
-1+2+4+8
83
15
+1+2+4+8
90
17
-1-2-4+8+16
101
19
+1-2-4+8+16
112
21
-1+2-4+8+16
123
23
+1+2-4+8+16
134
25
-1-2+4+8+16
145
27
+1-2+4+8+16

需特判的例外:
距離等於1時,答案為+1,而非-1+2


推論:


於是利用上兩推論可得公式:
1.求最高位H
[tex]H%3D%5Cleft%20%5Clfloor%20log_2dist%20%5Cright%20%5Crfloor[/tex]
2.求D值,即轉成N值相減
[tex]D%3D%5Cfrac%7Bdist+1%7D%7B2%7D-%5Cfrac%7B2%5EH+2%7D%7B2%7D[/tex]
簡單就能夠解決這一題了!








歡迎光臨 竹園論壇 (http://forum.tfcis.org/) Powered by Discuz! X3.2