You are viewing a single comment's thread from:

RE: [Question] Mathematics × Programming Competition #8 [問題] 數學 × 程式編寫比賽 (第八回)

in #contest7 years ago (edited)

用一行python语句把这道题解了,我是不是疯了?
https://steemit.com/cn/@speeding/one-line-python-math-programming

print(int(sum(map(lambda d: 0.5 if d != ''.join(map(lambda i:'012xx59x86'[int(i)], d[::-1])) and ''.join(map(lambda i:'012xx59x86'[int(i)], d[::-1])) in ['%04d' % x for x in range(0, 10000)] else 1 , ['%04d' % x for x in range(0, 10000)]))))

Sort:  

这个可以有,PYTHON一向以一行代码解题著称,不过写出来的代码没有维护性,很难改,用于快速刷题可以的。

只是好玩