Projecteuler (287) Quadtree - 拼圖
By John
at 2010-04-11T09:51
at 2010-04-11T09:51
Table of Contents
ProjectEuler (287) Quadtree
http://projecteuler.net/index.php?section=problems&id=287
所謂的 Quadtree 編碼可以將一個 2^N x 2^N 的黑白影像編成一系列的位元。
這個序列如下解讀:
* 第一個位元表示整個 2^N x 2^N 影像:
* 若它是 0 則表示分割,將整個 2^N x 2^N 切成相等的 2^(N-1) x 2^(N-1) 四塊,
接下來的序列依序為左上、右上、左下、右下的編碼;
* 若它是 10 則表示這整塊是黑色;
* 若它是 11 則表示這整塊是白色。
例如下面的圖案:
■■■□
■■□■
□□■■
□□■■
它可以由不只一個序列描述,像是: (見右圖分割)
■■■□
001010101001011111011010101010,長度為30,或是 ■■□■
□□■■
0100101111101110,長度是16,也是這個圖案的最短長度。 □□■■
對一個正整數 N,定義 D_N 是以下描述的 2^N x 2^N 圖案:
* 座標 x=0, y=0 代表左下角的點;
* 對某點 (x,y) 若 (x-2^(N-1))^2 + (y-2^(N-1))^2 ≦ 2^(2N-2) 則該點是黑色;
否則該點是白色。
求出 D_24 的最短長度。
--
既然這才是本週的題目就一起貼吧
是說我和 utomaya 在上一題的推文中討論這一題還討論得頗開心 XDrz
--
'Oh, Harry, dont't you see?' Hermione breathed. 'If she could have done
one thing to make absolutely sure that every single person in this school
will read your interview, it was banning it!'
---'Harry Potter and the order of the phoenix', P513
--
Tags:
拼圖
All Comments
By Andrew
at 2010-04-12T16:57
at 2010-04-12T16:57
By Kristin
at 2010-04-15T23:52
at 2010-04-15T23:52
By Blanche
at 2010-04-16T08:44
at 2010-04-16T08:44
By Victoria
at 2010-04-18T11:04
at 2010-04-18T11:04
By Ingrid
at 2010-04-22T08:43
at 2010-04-22T08:43
By Olive
at 2010-04-22T14:21
at 2010-04-22T14:21
By Kumar
at 2010-04-26T21:09
at 2010-04-26T21:09
By Hedda
at 2010-04-30T10:04
at 2010-04-30T10:04
By Joe
at 2010-05-04T04:02
at 2010-05-04T04:02
By Lydia
at 2010-05-06T09:34
at 2010-05-06T09:34
By Bennie
at 2010-05-11T06:32
at 2010-05-11T06:32
By Anonymous
at 2010-05-15T12:57
at 2010-05-15T12:57
By Ida
at 2010-05-19T17:03
at 2010-05-19T17:03
By Kelly
at 2010-05-20T07:50
at 2010-05-20T07:50
By Lauren
at 2010-05-22T00:39
at 2010-05-22T00:39
By Emma
at 2010-05-23T19:12
at 2010-05-23T19:12
By Dorothy
at 2010-05-28T02:41
at 2010-05-28T02:41
Related Posts
數闇 011
By Skylar Davis
at 2010-04-11T00:34
at 2010-04-11T00:34
數闇 011
By Kumar
at 2010-04-10T23:40
at 2010-04-10T23:40
數闇 010
By Genevieve
at 2010-04-10T23:26
at 2010-04-10T23:26
Projecteuler (286)
By Hedy
at 2010-04-10T19:36
at 2010-04-10T19:36
數闇 010
By Anthony
at 2010-04-10T17:47
at 2010-04-10T17:47