- 分享
2024/1/13 19:18
- 2024-1-13 19:18:26 @
#p1085
#解法1
n=int(input())
s=0
for i in range(1,n+1):
t=1
for j in range(1,i+1):
t=t*j
s+=t
print(s)
#解法2
n = int(input())
jie = 1
sum = 0
i = 1
while n >= i:
jie= jie * i
sum = sum + jie
i = i + 1
print(sum)
0 条评论
目前还没有评论...