贴一下代码,洛谷全ac
k=int(input())
sum=0
count=0 #count记录天数
for i in range(1,k+1):
for j in range(1,i+1):
if count == k:
break
sum+=i
count+=1
print(sum)
贴一下代码,洛谷全ac
k=int(input())
sum=0
count=0 #count记录天数
for i in range(1,k+1):
for j in range(1,i+1):
if count == k:
break
sum+=i
count+=1
print(sum)