__Harry_Haiyun__ @ 2023-06-22 12:46:26
Python 3
写会全RE??? k = int(input())
all = 0
for i in range(k + 1):
for j in range(i):
all = sum(i,all)
print(all)
by Terrible @ 2023-06-22 12:49:27
@Harry_Haiyun 因为你写的程序不对,sum(i,all)
是什么东西?
by __Harry_Haiyun__ @ 2023-06-22 12:51:26
k = int(input())
all = 0
for i in range(k + 1):
for j in range(i):
all += i
print(all)
by Terrible @ 2023-06-22 12:52:04
这程序写得可谓是还欠缺一点理解,你再想想吧。
你这个意思是:
第一天得到
by Ups_and_downs @ 2023-06-22 12:54:20
很简单,如果你在本地跑的时候就会发现一个type error:'int' object is not iterable 楼上说的很对
by Sprague_Garundy @ 2023-06-22 13:06:40
我都说了,如果你想用 Python 水题又不仔细去查函数的用法你还是用 C++ 写吧。
by denghuolanshan_1004 @ 2023-06-22 13:53:08
@Harry_Haiyun 第一行缩进?