a092: sum of N nums
Tags : 循環
Accepted rate : 173人/177人 ( 98% ) [非即時]
評分方式:
Strictly

最近更新 : 2022-08-15 05:08

Content

Given N integer numbers, please print the sum of those numbers as the result

Input

a list or numpy array "nums" containing N int number

each number < 999999

Output

an integer

Sample Input #1
2 8 10 13 54 2 8 10 13 54 2 8 10 13 54
Sample Output #1
261
Sample Input #2
1 2 3 4 5 6 8 8 9 1 1 -5 -111 -9999
Sample Output #2
-10067
測資資訊:
記憶體限制: 64 MB
不公開 測資點#0 (33%): 1.0s , <1K
不公開 測資點#1 (33%): 1.0s , <1K
不公開 測資點#2 (34%): 1.0s , <1K
Hint :

Can use a simple "loop" to sum each element or use "sum"function from numpy(you need to "convert" the python list to numpy array first)

Tags:
循環
出處:
[管理者:
kichan@g.pui... (陳嘉賢CHAN KA IN)
]


ID User Problem Subject Hit Post Date
沒有發現任何「解題報告」