ŽF¯L.XIå
なんと -52バイト おかげで @Adnanので、明らかに05AB1Eのローマ数字のビルトインは文書化されていなかったので、ハハ.. xD
オンラインで試すたり、すべてのテストケースを確認してください。
説明:
ŽF¯ # Push comressed integer 3999
L # Create a list in the range [1,3999]
.X # Convert each integer in this list to a roman number string
Iå # Check if the input is in this list
# (and output the result implicitly)
この05AB1Eのヒント(大きな整数を圧縮する方法は?)を参照して、理由を理解してくださいŽF¯
は3999
。
元の61バイトの回答:
•1∞Γ'иÛnuÞ\₂…•Ž8вв€SÐ)v.•6#&‘нδ•u3ôNèyè}'M3L×)Rεõš}`3Fâ}€˜JIå
オンラインで試すたり、すべてのテストケースを確認してください。
説明:
•1∞Γ'иÛnuÞ\₂…• '# Push compressed integer 397940501547566186191992778
Ž8в # Push compressed integer 2112
в # Convert the integer to Base-2112 as list:
# [1,11,111,12,2,21,211,2111,10]
€S # Convert each number to a list of digits
Ð # Triplicate this list
) # And wrap it into a list of lists (of lists)
v # Loop `y` over each these three lists:
.•6#&‘нδ• # Push compressed string "xivcxlmcd"
u # Uppercased
3ô # And split into parts of size 3: ["XIV","CXL","MCD"]
Nè # Use the loop index to get the current part
yè # And index the list of lists of digits into this string
}'M '# After the loop: push "M"
3L # Push list [1,2,3]
× # Repeat the "M" that many times: ["M","MM","MMM"]
) # Wrap all lists on the stack into a list:
# [[["I"],["I","I"],["I","I","I"],["I","V"],["V"],["V","I"],["V","I","I"],["V","I","I","I"],["I","X"]],[["X"],["X","X"],["X","X","X"],["X","L"],["L"],["L","X"],["L","X","X"],["L","X","X","X"],["X","C"]],[["C"],["C","C"],["C","C","C"],["C","D"],["D"],["D","C"],["D","C","C"],["D","C","C","C"],["C","M"]],["M","MM","MMM"]]
R # Reverse this list
εõš} # Prepend an empty string "" before each inner list
` # Push the four lists onto the stack
3F # Loop 3 times:
â # Take the cartesian product of the two top lists
}€˜ # After the loop: flatten each inner list
J # Join each inner list together to a single string
Iå # And check if the input is in this list
# (after which the result is output implicitly)
鉱山(セクションのこの05AB1E先を参照してくださいどのように圧縮文字列にない辞書の一部を?、?大きな整数を圧縮する方法、およびどのようにリストの整数圧縮方法は?)理由を理解します:
•1∞Γ'иÛnuÞ\₂…•
は 397940501547566186191992778
Ž8в
は 2112
•1∞Γ'иÛnuÞ\₂…•Ž8вв
は [1,11,111,12,2,21,211,2111,10]
.•6#&‘нδ•
は "xivcxlmcd"