'l¡ε'r¡}0ζćs˜‚€S„udS1®‚:OŽ9¦2ä%T‰J':ý
用途udlr
为方向,但也可以使用^v<>
了相同的字节数(字符↑↓←→
不是05AB1E的代码页的一部分,所以使用这些会被大量增加的字节数,因为编码应改为ASCII)。
在线尝试或验证所有测试用例。
说明:
'l¡ '# Split the (implicit) input on "l"
# i.e. "lllrurulddd" → ["","","","ruru","ddd"]
ε } # Map each item to:
'r¡ '# Split the item on "r"
# i.e. ["","","","ruru","ddd"] → [[""],[""],[""],["","u","u"],["ddd"]]
0ζ # Zip/transpose; swapping rows/columns, with "0" as filler
# i.e. [[""],[""],[""],["","u","u"],["ddd"]]
# → [["","","","","ddd"],["0","0","0","u","0"],["0","0","0","u","0"]]
ć # Head extracted: pop and push the remainder and head-item to the stack
# i.e. [["","","","","ddd"],["0","0","0","u","0"],["0","0","0","u","0"]]
# → [["0","0","0","u","0"],["0","0","0","u","0"]] and ["","","","","ddd"]
s # Swap to get the remainder
˜ # Flatten it
# i.e. [["0","0","0","u","0"],["0","0","0","u","0"]]
# → ["0","0","0","u","0","0","0","0","u","0"]
‚ # Pair the head and remainder back together
# i.e. ["","","","","ddd"] and ["0","0","0","u","0","0","0","0","u","0"]
# → [["","","","","ddd"],["0","0","0","u","0","0","0","0","u","0"]]
€S # Convert each item to a list of characters
# (implicitly flattens and removes empty strings)
# i.e. [["","","","","ddd"],["0","0","0","u","0","0","0","0","u","0"]]
# → [["d","d","d"],["0","0","0","u","0","0","0","0","u","0"]]
„udS1®‚: # Replace all "u" with "1" and all "d" with "-1"
# i.e. [["d","d","d"],["0","0","0","u","0","0","0","0","u","0"]]
# → [["-1","-1","-1"],["0","0","0","1","0","0","0","0","1","0"]]
O # Then take the sum of each inner list
# i.e. [["-1","-1","-1"],["0","0","0","1","0","0","0","0","1","0"]]
# → [-3,2]
Ž9¦ # Push compressed integer 2460
2ä # Split into two parts: [24,60]
% # Modulo the two lists
# i.e. [-3,2] and [24,60] → [21,2]
T‰ # Divmod each with 10
# i.e. [21,2] → [[2,1],[0,2]]
J # Join each inner list together
# i.e. [[2,1],[0,2]] → ["21","02"]
':ý '# Join the list with ":" delimiter
# i.e. ["21","02"] → "21:02"
# (and output the result implicitly)
看到这个05AB1E尖矿(部分如何压缩大整数?)理解为什么Ž9¦
是2460
。
0123
)会使某些语言的挑战变得容易得多,而对其他语言则没有好处。