始终在给定问题中获得运行时间

问题描述 投票:0回答:0

问题 给定一个由 N 个整数组成的数组 A。

任务

打印数组中元素的总和。

注意:有些整数可能很大。

输入格式

第一行包含一个整数 N 表示数组的大小。
下一行包含表示数组元素的空格分隔整数。 输出格式

打印表示数组中元素总和的单个值。

限制

1<=N<=10

0<=a[i]<=10^10

n = []

a = int(input())
for i in range(a):
    b = (int, input().split())
    n.extend(b)

sum = 0
for j in n:
    sum += j

print(sum)

当我使用代码编辑器时,它只是向我显示输出,但在提交代码时,它向我显示运行时错误。有什么问题吗?

python visual-studio-code editor python-3.10 dsa
© www.soinside.com 2019 - 2024. All rights reserved.