Ÿʒ₄n+¦S3ôOË
在线尝试或验证更多测试用例。
注意:在05AB1E中,字符串和整数是可互换的,因此输出数字不包含前导零。但是,这可以通过增加1个字节(12个字节)来解决:
Ÿ₄n+€¦ʒS3ôOË
在线尝试或验证更多测试用例。
+3个字节以3个以下的错误修正数字(范围[000000, 000999]
)。
说明:
Ÿ # Create an inclusive (on both sides) range from the two inputs
# i.e. 038920 and 038910 →
# [38910,38911,38912,38913,38914,38915,38916,38917,38918,38919,38920]
ʒ # Filter this list by:
₄n+ # Add 1,000,000 to the number
| # And remove the leading 1
# i.e. 38910 → 1038910 → '038910'
S # Transform it to a list of digits
# i.e. '038910' → ['0','3','8','9','1','0']
3ô # Split it into chunks of length 3
# i.e. ['0','3','8','9','1','0'] → [['0','3','8'],['9','1','0']]
O # Sum the digits in both parts
# i.e. [['0','3','8'],['9','1','0']] → [11,10]
Ë # Check if they are equal (if they are, they remain in the filtered list)
# i.e. [11,10] → 0
编辑:似乎我(和大多数其他答案)略微误解了挑战,并要求输入数量而不是范围内的数字本身。在这种情况下,}g
可以添加尾随(关闭过滤器;并获取过滤后的列表中剩余的数字量),因此改为10个 13 字节:
Ÿʒ₄n+¦S3ôOË}g
在线尝试或验证更多测试用例。