Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
71469 | 朱震耀老师 | 函数求阶乘 | Python3 | Accepted | 36 MS | 3744 KB | 398 | 2024-04-24 19:27:49 |
def factorial(n): def calculate_factorial(k): if k == 0: return 1 else: return k * last_factorial last_factorial = 1 for i in range(1, n + 1): current_factorial = calculate_factorial(i) print(current_factorial, end=' ') last_factorial = current_factorial # 示例用法 n = int(input()) factorial(n)