一篇文章搞定編號系覺醒
? ? ? ?最近游戲王OCG出了一張新卡(劃掉,等我發(fā)專欄的時候應(yīng)該不是新卡了)超量支援卡,編號系覺醒。對,就是下面這貨。

以下是K語言時間。
? ? ? ?編號系覺醒,通常魔法,無限制,效果是①:從額外卡組特殊召喚的怪獸只有對方場上才存在的場合才能發(fā)動。從額外卡組選4只「No.」XYZ怪獸(相同階級最多1只)?!窷o.」數(shù)值和那4只的合計相同的1只「No.」XYZ怪獸當(dāng)作XYZ召喚從額外卡組特殊召喚,把選的怪獸全部在那只怪獸下面重疊作為XYZ素材。只要這個效果特殊召喚的怪獸在自己場上表側(cè)表示存在,自己不是「No.」XYZ怪獸不能特殊召喚。

?? ? ? 大伙一看,好,一卡四素材槍王,一卡ll打臉主階二變天庭號……想法都很不錯,問題是要把一個數(shù)拆成四個數(shù)之和,所對應(yīng)的「No.」怪獸的階級還要各不相同。那些主流的相加方法很快就會有大佬總結(jié)出來,但對于整活玩家(比如命運獅子特殊勝利)來說,這個拆解是個艱難的過程。本人利用僅有的C#知識(其實是C++知識,除了用了C#的語法,一個Class都沒有寫)寫了一段程序(因為是專用程序,沒有任何可拓展性,我會把屎山代碼放在評論區(qū))把「No.1」到「No.107」的拆分方法全部扒了出來(根據(jù)2022年1月表),接下來就是運行結(jié)果:

1 is unable to xyz.
2 is unable to xyz.
3 is unable to xyz.
4 is unable to xyz.
5 is unable to xyz.
6 is unable to xyz.
7 is unable to xyz.
8 = 0 (R1) + 1 (R2) + 3 (R3) + 4 (R4).
9 = 0 (R1) + 1 (R2) + 3 (R3) + 5 (R6).
10 = 0 (R1) + 1 (R2) + 4 (R4) + 5 (R6).
11 = 0 (R1) + 1 (R2) + 5 (R5) + 5 (R6).
12 = 0 (R1) + 3 (R3) + 4 (R4) + 5 (R6).
13 = 1 (R2) + 3 (R3) + 4 (R4) + 5 (R6).
14 = 1 (R2) + 3 (R3) + 5 (R5) + 5 (R6).
15 = 1 (R2) + 4 (R4) + 5 (R5) + 5 (R6).
16 = 1 (R2) + 4 (R4) + 5 (R6) + 6 (R7).
17 = 3 (R3) + 4 (R4) + 5 (R5) + 5 (R6).
18 = 3 (R3) + 4 (R4) + 5 (R6) + 6 (R7).
19 = 3 (R3) + 5 (R5) + 5 (R6) + 6 (R7).
20 = 4 (R4) + 5 (R5) + 5 (R6) + 6 (R7).
21 = 4 (R4) + 5 (R5) + 6 (R6) + 6 (R7).
22 = 4 (R4) + 5 (R5) + 6 (R6) + 7 (R7).
23 = 4 (R4) + 5 (R5) + 5 (R6) + 9 (R10).
24 = 4 (R4) + 5 (R6) + 6 (R7) + 9 (R10).
25 = 5 (R5) + 5 (R6) + 6 (R7) + 9 (R10).
26 = 5 (R5) + 6 (R6) + 6 (R7) + 9 (R10).
27 = 5 (R5) + 6 (R6) + 7 (R7) + 9 (R10).
28 = 5 (R5) + 5 (R6) + 9 (R9) + 9 (R10).
29 = 5 (R6) + 6 (R7) + 9 (R9) + 9 (R10).
30 = 6 (R6) + 6 (R7) + 9 (R9) + 9 (R10).
31 = 6 (R6) + 7 (R7) + 9 (R9) + 9 (R10).
32 = 12 (R5) + 5 (R6) + 6 (R7) + 9 (R10).
33 = 12 (R5) + 6 (R6) + 6 (R7) + 9 (R10).
34 = 5 (R6) + 11 (R7) + 9 (R9) + 9 (R10).
35 = 6 (R6) + 11 (R7) + 9 (R9) + 9 (R10).
36 = 6 (R6) + 6 (R7) + 15 (R9) + 9 (R10).
37 = 6 (R6) + 7 (R7) + 15 (R9) + 9 (R10).
38 = 5 (R6) + 15 (R8) + 9 (R9) + 9 (R10).
39 = 6 (R7) + 15 (R8) + 9 (R9) + 9 (R10).
40 = 7 (R7) + 15 (R8) + 9 (R9) + 9 (R10).
41 = 6 (R6) + 11 (R7) + 15 (R9) + 9 (R10).
42 = 5 (R6) + 6 (R7) + 22 (R8) + 9 (R10).
43 = 6 (R6) + 6 (R7) + 22 (R8) + 9 (R10).
44 = 11 (R7) + 15 (R8) + 9 (R9) + 9 (R10).
45 = 6 (R7) + 15 (R8) + 15 (R9) + 9 (R10).
46 = 7 (R7) + 15 (R8) + 15 (R9) + 9 (R10).
47 = 7 (R7) + 22 (R8) + 9 (R9) + 9 (R10).
48 = 7 (R7) + 23 (R8) + 9 (R9) + 9 (R10).
49 = 25 (R6) + 6 (R7) + 9 (R9) + 9 (R10).
50 = 11 (R7) + 15 (R8) + 15 (R9) + 9 (R10).
51 = 11 (R7) + 22 (R8) + 9 (R9) + 9 (R10).
52 = 11 (R7) + 23 (R8) + 9 (R9) + 9 (R10).
53 = 7 (R7) + 22 (R8) + 15 (R9) + 9 (R10).
54 = 7 (R7) + 23 (R8) + 15 (R9) + 9 (R10).
55 = 25 (R6) + 6 (R7) + 15 (R9) + 9 (R10).
56 = 25 (R6) + 7 (R7) + 15 (R9) + 9 (R10).
57 = 11 (R7) + 22 (R8) + 15 (R9) + 9 (R10).
58 = 11 (R7) + 23 (R8) + 15 (R9) + 9 (R10).
59 = 24 (R6) + 11 (R7) + 15 (R9) + 9 (R10).
60 = 21 (R6) + 15 (R8) + 15 (R9) + 9 (R10).
61 = 28 (R7) + 15 (R8) + 9 (R9) + 9 (R10).
62 = 6 (R7) + 38 (R8) + 9 (R9) + 9 (R10).
63 = 7 (R7) + 38 (R8) + 9 (R9) + 9 (R10).
64 = 6 (R7) + 40 (R8) + 9 (R9) + 9 (R10).
65 = 7 (R7) + 40 (R8) + 9 (R9) + 9 (R10).
66 = 7 (R7) + 15 (R8) + 9 (R9) + 35 (R10).
67 = 28 (R7) + 15 (R8) + 15 (R9) + 9 (R10).
68 = 28 (R7) + 22 (R8) + 9 (R9) + 9 (R10).
69 = 28 (R7) + 23 (R8) + 9 (R9) + 9 (R10).
70 = 11 (R7) + 15 (R8) + 9 (R9) + 35 (R10).
71 = 7 (R7) + 46 (R8) + 9 (R9) + 9 (R10).
72 = 7 (R7) + 15 (R8) + 15 (R9) + 35 (R10).
73 = 11 (R7) + 38 (R8) + 15 (R9) + 9 (R10).
74 = 28 (R7) + 22 (R8) + 15 (R9) + 9 (R10).
75 = 42 (R7) + 15 (R8) + 9 (R9) + 9 (R10).
76 = 11 (R7) + 15 (R8) + 15 (R9) + 35 (R10).
77 = 11 (R7) + 22 (R8) + 9 (R9) + 35 (R10).
78 = 11 (R7) + 23 (R8) + 9 (R9) + 35 (R10).
79 = 7 (R7) + 23 (R8) + 40 (R9) + 9 (R10).
80 = 7 (R7) + 23 (R8) + 15 (R9) + 35 (R10).
81 = 42 (R7) + 15 (R8) + 15 (R9) + 9 (R10).
82 = 42 (R7) + 22 (R8) + 9 (R9) + 9 (R10).
83 = 42 (R7) + 23 (R8) + 9 (R9) + 9 (R10).
84 = 28 (R7) + 38 (R8) + 9 (R9) + 9 (R10).
85 = 39 (R6) + 22 (R8) + 15 (R9) + 9 (R10).
86 = 28 (R7) + 40 (R8) + 9 (R9) + 9 (R10).
87 = 28 (R7) + 15 (R8) + 9 (R9) + 35 (R10).
88 = 42 (R7) + 22 (R8) + 15 (R9) + 9 (R10).
89 = 42 (R7) + 23 (R8) + 15 (R9) + 9 (R10).
90 = 28 (R7) + 38 (R8) + 15 (R9) + 9 (R10).
91 = 11 (R7) + 62 (R8) + 9 (R9) + 9 (R10).
92 = 28 (R7) + 46 (R8) + 9 (R9) + 9 (R10).
93 = 28 (R7) + 15 (R8) + 15 (R9) + 35 (R10).
94 = 28 (R7) + 22 (R8) + 9 (R9) + 35 (R10).
95 = 28 (R7) + 23 (R8) + 9 (R9) + 35 (R10).
96 = 7 (R7) + 40 (R8) + 40 (R9) + 9 (R10).
97 = 11 (R7) + 68 (R8) + 9 (R9) + 9 (R10).
98 = 42 (R7) + 38 (R8) + 9 (R9) + 9 (R10).
99 = 28 (R7) + 22 (R8) + 40 (R9) + 9 (R10).
100 = 42 (R7) + 40 (R8) + 9 (R9) + 9 (R10).
101 = 6 (R7) + 9 (R9) + 9 (R10) + 77 (R12).
102 = 7 (R7) + 9 (R9) + 9 (R10) + 77 (R12).
103 = 11 (R7) + 68 (R8) + 15 (R9) + 9 (R10).
104 = 42 (R7) + 38 (R8) + 15 (R9) + 9 (R10).
105 = 7 (R7) + 23 (R8) + 40 (R9) + 35 (R10).
106 = 11 (R7) + 9 (R9) + 9 (R10) + 77 (R12).
107 = 6 (R7) + 15 (R9) + 9 (R10) + 77 (R12).

? ? ? ?看到這里的小伙伴們?nèi)绻皇菫榱私鉀Q以后整活方便的話已經(jīng)可以點個收藏走人了(可以順手點個贊就更好了),接下來就是程序的原理部分了。
? ? ? ?我一開始的想法是對自然數(shù)做拆分然后判斷是否可以出現(xiàn)在不同階級,后來我發(fā)現(xiàn)有的「No.」還呆著禁卡表里(如暗物質(zhì),色支),有的占據(jù)多個階級(如「No.39」,有1、4、5、6四個階級),判斷函數(shù)非常惡心。于是我反其道而行之,直接按照現(xiàn)有的卡分好階然后將所有求和方式都列出來,這樣雖然做了許多無用功(同一個「No.」的每一種正確拆分都運算過,但只保留了一個),但這樣把一個求解型問題轉(zhuǎn)化為一個驗證型問題還是舒服多了。最后就是我的8個for循環(huán)的屎山參觀了。