解题思路:
见代码注释
参考代码:
n = int(input()) def func(num): # 返回最右侧的非0值 s = str(num) for i in s[::-1]: if i == '0': continue else: return int(i) def main(n): dp = [1 for i in range(n)] for i in range(1, n): dp[i] = (i+1) * dp[i-1] return func(dp[-1]) if __name__ == '__main__': print(main(n))
0.0分
1 人评分