人力资源机器19-24满星攻略
冲鸭!!!
第19层-倒计时
新指令
bump+
:从指定的瓷砖上+1,并将结果写回地板,结果也会放回到你的手上bump-
:从指定的瓷砖上-1,并将结果写回地板,结果也会放回到你的手上
挑战体积
思路是,输入之后立马输出一下,然后看看刚才的输出(output之后手上就没有数字了,再copyfrom一下)是否为0(并跳转).接着按正、负进行不同的增减运算,输出,输出之后再看看刚才的输出是否为0(并跳转或循环)。1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26-- HUMAN RESOURCE MACHINE PROGRAM --
COMMENT 0
a:
INBOX
COPYTO 0
b:
c:
OUTBOX
COPYFROM 0
JUMPZ a
JUMPN d
BUMPDN 0
JUMP b
d:
BUMPUP 0
JUMP c
DEFINE COMMENT 0
eJyzYGBgiFN/rrtPunTKTcFL14Bchv9GMSEshn+y2gze9x8y/DNjl0nX4g0Wk1eutQxZlW0luELOPrP7
vl1IzSLbtqI0m9dxGdZLIjdYRATuMgnxA+nnKS005Sk96Taj4Jo/iL+ren5YR9n3dJWcmKZPaVo921Jf
9/xIWdEFkjtV6lzQW3KpakLxj6nni08u8i5V2gISD+086bZuurUNiL20maPEq/dP1sz5W1K7l2xIAomZ
TuUpL5nKMCd/+r2Nr2ccPbtmRsTt/OlLHq+b/uPjxmk7P22ZuvV9e5/7eYZRMApGAV4AADJSY8s;
挑战速度
根据上面的思路,我们只需要省略输出前的那步copyfrom就可以提高效率。做法是:利用bump±的特性,当我们进行bump±之后我们的手上会得到一个数字,这就解决了我们在上面的代码中output之后因为手上没有数从而没法输出的问题。1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66-- HUMAN RESOURCE MACHINE PROGRAM --
COMMENT 6
a:
INBOX
JUMPZ e
COPYTO 0
JUMPN c
COMMENT 2
b:
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PsJsfNaYI+dUmpUTtSXse9zXifOLXQPre3hKPEsfJ55/9Ks6n/Kw/OcazsWuxcEbD8
Uc7s9RvS7220T7q30SlRdiNTouQ6kLlLmxkc9kxicNg2pckRxO/qbXPp6lWLntQl2SDQfW7pmZ7UbSBx
8QVNjlcXTPadvDCg8uqCz5MmL2SYE7Lw3NKJi2avv7yw7NDTTWWHQOrCF+y13bCuzi5v/UGHT2tvBYHE
3JfZ52ZubCsCsY2PmlluOcKQZ3Bs78yPR+1PFh01PwwStzjs7VF0tM4u9dQW8/lnjMz8L20xb7x+1Pnz
ndnBWg8yY58+NEtf+cA+9/C1S1Uzz81udNu3oothFIwCKgAAGUTA6g;
第20层-乘法研讨会
// 新注释!
现在可以在地砖上画注释了
挑战体积
朴素算法。三块地转,一块a,一块b,一块res存储结果。
反复给res+=a,直到b为0为止。1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46-- HUMAN RESOURCE MACHINE PROGRAM --
COMMENT 0
a:
INBOX
COPYTO 0
COPYTO 2
INBOX
COPYTO 1
b:
JUMPZ d
BUMPDN 1
JUMPZ c
COPYFROM 2
ADD 0
COPYTO 2
JUMP b
c:
COPYFROM 2
d:
OUTBOX
JUMP a
DEFINE COMMENT 0
eJwzZmBgqJS9ZLpbZk08q2TdLCCXodh8sfYl89K09xY7M8ycdmY88UjIk/PmKLH2Ea29463X3+phPWOq
0+O5c+0fz+2wjpkJ0sNjFWGl5/rZ7I53rhGIf74+QXNu1SXTpeURVtmlEVYgMe/GNhee0pDUuLzSNBC/
osY95nrN0cLgunvNm+p+TAWJvew9qlM0TVYdxH7TsCY+oXVNfOT8yb5Hl032BYkZTH+feHGad9m3KfNn
h069tH/6FNFD0pM/H1jfLbiCYRSMglFAMgAAb1VO8w;
DEFINE LABEL 0
eJwTZGBg2FTHEmVWWxdqVyUZxFLxPSCsUDJocppgclnqn6yy1OdFn9IuVaVlK7b9z23r/F7Q1vmnKrfc
uzEklbOJoTWhdfIkhkEIMuNiZgamZy4KKzRamVxhv2l7B8fOZ7N8dg+0u0bBKBhsAACmdyia;
DEFINE LABEL 1
eJwTY2BgkGs76ZbQeitzVWPiZu9GpdMgGijWvb1DtDa3x7tszyTvstCpl6reTd/btHj2tSnyc88tlZ8r
u/HZrP693DPND1+cNvvYy962cxEdJy8sajl5wbvR+QzDKBgFo2BIAADMgi4l;
DEFINE LABEL 2
eJzTY2BgmGF6NmGr2d7jIubmh7eanez2s+QoYbGdnr7LQTA5weuaP1AJA1+g5PS/YfNnC0XPn82UaD1j
R8rkSd2Z95pXZInWrsjqr+jOfF40Oe1P1q/k6ek+sTszzCO1SmPCqxr+hq3oYgvJXLQ82H5TTHjunq+R
l/afiBM9FJgueqg6X2tXcVHiZpD5Z3oS8iI6lhQktHqXObeI1jq3zG5kbG3rvNMWMEF5gvvC+RONVkpP
zt2j3bth35sGn90MdARrLi/WNrjU5nLz3PT0ptNrlsw/I7ii/sbz7TtvPd9+7faSraZ3ZDeC1D3ZdzZh
+cn3idduWwdvfb7Fj55uHAWjgFwAAOZ5cdo;
挑战速度
只用了102步,小于官方要求的108步。
这个优化便是,针对a*b运算,取a和b中较小的那个来进行循环;如果a、b中有一个为0,则直接输出9号砖上的0.
1 | -- HUMAN RESOURCE MACHINE PROGRAM -- |
第21层-以零结尾的求和
挑战体积
首先初始化一下res存放结果的地砖,然后每次取一个输入加到res上去,直到取出0为止。1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32-- HUMAN RESOURCE MACHINE PROGRAM --
COMMENT 0
a:
COPYFROM 5
COPYTO 0
b:
INBOX
JUMPZ c
ADD 0
COPYTO 0
JUMP b
c:
COPYFROM 0
OUTBOX
JUMP a
DEFINE COMMENT 0
eJwzYmBgcDRydvLTZcjLUZLd+Fne+hhQiCHPsik/z7Jw4hvLPzOW2rgvnGvPuzTCkXfpQc8/M775bpjw
0V+tc33Aveb1AYJVH/29yyx8WQqbPA/mgfTK5wn6qORoxb3K3JtdksZTbpUiWAUS5ykNqbmVr9a5OtNs
qns871LZcMl1IPHdySzzy1L7l2VmtZ0D8XMb1KKndN4LBbEdK/X6K2py+3x7ZjcqzYGY83nq654tU3dO
Wzf92mqjaZOvM0/4cZhhFIyCUUAWAABW0EwD;
DEFINE LABEL 0
eJyzZGBg6BS3Du4Uf5+4TGJDZYrkpf1KUqlngcIM86QvVUnJHi1UVxFM5tedHxZmtsUPJJ5sGzChwnHy
pFVukydF+Or1dwWldjwInd14IyK3/EL02YTC6Mm+m6P0vKQiTrqlhrS5BAS0uWS4T/b1dvse0GEtmCxi
npD33ZSjZIbpveb3FoUTrzuWrr7jbX54efDJCyFRry/aJM8+tiJLaxfIrtT+swnL+7ricnsyYyM6MmOv
1yTksVSI1rJUzG48VMHQWlHzusesNmDClc6uxXw9gitye0pXn+nZsE+sU/TQ8SbRQ8F1G/YxjIJRMApw
AgD9zmBf;
挑战速度
程序一共是71步。这里直接把5号地砖上的0作为初始值,然后对于第一组数据就直接加到5号地砖上就可以,直到拿到数字0,直接输出。接下来处理后面的数据,如果为0则直接输出这个数列,然后立刻开始处理下一组数据;不然就将此输入覆盖5号地砖上的值进行初始化,然后回到最开始的处理方法上去(后面的数据直接加到5号地砖上就可以)。1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26-- HUMAN RESOURCE MACHINE PROGRAM --
COMMENT 0
a:
b:
INBOX
JUMPZ c
ADD 5
COPYTO 5
JUMP b
c:
COPYFROM 5
d:
OUTBOX
INBOX
JUMPZ d
COPYTO 5
JUMP a
DEFINE COMMENT 0
eJxTZ2BguCz8x+ac6HfLbXIbTOapvzeW0fhsNk+9zWW10vPOQoXC/UAlDM+tP5ul2WTuBLGLpl2S+zzV
2gbEfjddz/juXD1jENujb7H2yV7JIBD7fX1EoHT7/LAj/Y8iAhctiQSJWUzJTfg9aXL170l6/SC+QLds
87WO550g9ry5txrypzfN3TL15KJVjc+3/6lasYNhFIyCUUBzAABo+z3d;
第22层-斐波那契参观者
AK代码
17行/132步
的好成绩。
三块地转:a、b、n。n为输入,a为当前的斐波那契值,b为a之后的下一个斐波那契值。
首先是将9号地砖上的0加一,给后面的初始化用。
然后拿9号地砖上的1初始化 a 和 b = 1
将输入放到 n 上
接着开始循环:
- 输出地砖a上的值
- 计算(a+b)并拷贝到b上
- (a+b)-a,并拷贝a上,这一步相当于把b的旧值搬运到了a上
- a-n,判断此时是否应该跳出循环。
- 从第1步开始循环。
如果跳出了循环,则从9号地砖复制一下,拿去初始化a和b。1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49-- HUMAN RESOURCE MACHINE PROGRAM --
COMMENT 0
BUMPUP 9
a:
COPYTO 0
COPYTO 1
INBOX
COPYTO 2
b:
c:
COPYFROM 0
OUTBOX
COPYFROM 0
ADD 1
COPYTO 1
SUB 0
COPYTO 0
SUB 2
JUMPN c
JUMPZ b
COPYFROM 9
JUMP a
DEFINE COMMENT 0
eJwzYWBgWK8S5hmlcjJ1vVJuH5DLwGJyTzvS/prmeo9jqiw+O5VYfM6ps7gn+US63MxkcQ5oj3T6u5HF
UWwHSK39qscaX5bfSPiy/NzEnGUy20Fif/Z0OhkeNHHoORbn2HI61sPoXIz/t3OsId/ORcYePBWRcuLo
mrS/J+uLL5xd3jTl3IUuo3NV/X9PKk8xPFgxDaQ/8OH6CM9n6yMuPmeJrnulm8z2hjFT5219cd9bjfrd
L5WnJDz5utzp3tzN325/2rr65qetxi8+bc14U7hz7oc5uxhGwSgYBSQBAIIYY28;
DEFINE LABEL 0
eJyTYWBgiCzL848sS/JhLnB0Yck2dVyXbOrIEunrHhmS5RcZVB/MEvAwmyUgonN9QOXEdaFPVrOEf12/
LpJx87oExs0sKT83sGTdWLEud/mcdcX85ZGlK2KZS4C46FVuZGHftMii5XMii1fPZS49vJi55s1ahlEw
CkbBoAIAO3Yubg;
DEFINE LABEL 1
eJwTZWBgWJe3Ui4yL9AjMtumaV12+InInJqLkTm1kyLzfhUyFzzMZq58mL2ugassskW7LqItonNd+6Tp
zB03Vqxr/7huXYv1wXXN3kcj62ourivvvcqcN/EawygYBaNgyAAA4FMn1A;
DEFINE LABEL 2
eJyTYGBgYAkydGAJepfHEhDRyRKweX6kn/Ph9X61kyKDPN1YQmWsWSL/G7PEfDdkSf9uuC73v3FkEbsZ
c4mABXOpgs26Mk+3yModiZFVpRMiqxg3A41jWFf1c8O6Ku+jzFUF5xhGwSgYBYMaAAAtriJj;
DEFINE LABEL 9
eJwTZ2BgWJArq96dedKNP8M9hj/DKCUw/U9WYLpZXV5GakdeBm9fXN7OtTylPrsla6qOtjbvPR7R4bN7
Upf9puV916Yc6d9Qmdq/M2N99/ywTXVHdZaWy6pvLbTXmFHQpMUwCkbBKBj0AADTKyiA;
第23层-最小的数字
朴素做法
1 | -- HUMAN RESOURCE MACHINE PROGRAM -- |
AK代码
一个地砖:res,用于保存输出结果
对于串的第一个输入:直接放到res上
对于接下来的输入:
- 如果为0,则输出res,并开始对下一轮串的处理
- 与res比大小,更新res的值或是继续接收输入
1 | -- HUMAN RESOURCE MACHINE PROGRAM -- |
第24层-模运算模块
AK代码
53步11行
!
两块地砖a、b
反复计算a-b-b-b-b-b-b-b-b-b-b-b,直到第一次为负。
输出时再加一下b,然后输出就可以。1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45-- HUMAN RESOURCE MACHINE PROGRAM --
COMMENT 0
a:
INBOX
COPYTO 0
INBOX
COPYTO 1
COPYFROM 0
b:
SUB 1
JUMPN c
JUMP b
c:
ADD 1
OUTBOX
JUMP a
DEFINE COMMENT 0
eJzLZWBg8BVT1DonapQyRVivf6LI+34Gaa2er3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