'l¡ε'r¡}0ζćs˜‚€S„udS1®‚:OŽ9¦2ä%T‰J':ý
用途udlr
向きのためだけでなく、使用することができます^v<>
(文字が同じバイトカウントのために↑↓←→
そのエンコーディングはASCIIに変更する必要があるため、抽選でバイト数を増加させるそれらを使用して、05AB1Eのコードページの一部ではありません)。
オンラインそれを試してみたり、すべてのテストケースを確認してください。
説明:
'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)
理由を理解するにŽ9¦
は、この05AB1Eのヒント(大きな整数を圧縮する方法?)を参照してください2460
。
0123
)を選択すると、特定の言語ではチャレンジがはるかに簡単になり、他の言語ではメリットがなくなります。