Skip to content

Commit 4a38a36

Browse files
FiveYellowMice 的解答 (#14)
1 parent c473799 commit 4a38a36

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

FiveYellowMice/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
```Ruby
2+
c=33*3+3*3
3+
_=33*3-~23/2
4+
$><<'%c'*(32/3+3)%[3*3*2**3,-~322-222,c,c,_,22*2,32,32*2+23,_,32*3+3*3*2,c,322-222,33]
5+
```
6+
7+
## 解释
8+
9+
`$>` 代表标准输出,其 `<<` 操作符可以直接输出字符串。同时, `'%c' % 32` 可以把一个数字转换为相应的字符。因此剩下的就只是凑其 “Hello, World!” 中每个字符的 ASCII 编码了。此时我们只使用了 `c` 这一个字母,还剩下两个字符的配额可以用来凑数字,我们随意选择了 `2``3`
10+
11+
把代码的最后一行翻译成更易读的形式,则为 `STDOUT << '%c' * 13 % [72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33]`
12+
13+
凑数字的方式显然还有非常大的优化空间,但是凑数字的过程并不有趣,所以没有很大的功夫被花费于此。

FiveYellowMice/ccc.rb

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
c=33*3+3*3
2+
_=33*3-~23/2
3+
$><<'%c'*(32/3+3)%[3*3*2**3,-~322-222,c,c,_,22*2,32,32*2+23,_,32*3+3*3*2,c,322-222,33]

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323
| :--: | :----------------------------------------------------------: | :-------: | :--------------: | :--------------: |
2424
| 1 | [nocat](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/nocat) | 38 Bytes | PHP | make PHP greate again!|
2525
| 2 | [鼹鼠](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/%E9%BC%B9%E9%BC%A0) | 109 Bytes | JavaScript | |
26-
| 3 | [Jack-Works](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/Jack-Works) | 126 bytes | JavaScript | |
27-
| 3 | [benpigchu](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/benpigchu) | 142 Bytes | Python | 大概还能再压,但是懒 |
28-
| 4 | [GalvinGao](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/GalvinGao) | 3.3 KB | JavaScript | 感谢鼹鼠( |
26+
| 3 | [FiveYellowMice](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/FiveYellowMice) | 111 bytes | Ruby | 大概还能再压,但是懒 |
27+
| 4 | [Jack-Works](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/Jack-Works) | 126 bytes | JavaScript | |
28+
| 5 | [benpigchu](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/benpigchu) | 142 Bytes | Python | 大概还能再压,但是懒 |
29+
| 6 | [GalvinGao](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/GalvinGao) | 3.3 KB | JavaScript | 感谢鼹鼠( |
2930
| - | [谓道之求](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/%E8%B0%93%E9%81%93%E4%B9%8B%E6%B1%82) | 138 Bytes | Matlab | 过几天就符合规则了) |
3031
| - | [Nyaacinth](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/Nyaacinth) | 257 Bytes | Lua (LuaJIT) | 做不到,但是 Lua 值得有姓名! |
3132

0 commit comments

Comments
 (0)