YACS2022年7月丙组
作者:互联网
T1: 水仙花指数
模拟
代码实现
n = int(input())
ans = 0
while n != 0:
ans += (n%10)**3
n //= 10
print(ans)
T2:因数之和
遍历 \(i = 1, \cdots , N\),把 \(\lfloor\frac{N}{i}\rfloor \times i\) 累加进答案
代码实现
n = int(input())
ans = 0
for i in range(1, n+1):
ans += (n//i)*i
print(ans)
标签:10,int,代码,丙组,ans,print,input,YACS2022 来源: https://www.cnblogs.com/Melville/p/16489028.html