배열 모든 원소의 합을 출력하면 된다.
#!/bin/python3
import os
import sys
#
# Complete the simpleArraySum function below.
#
def simpleArraySum(ar):
#
# Write your code here.
#
return sum(ar)
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
ar_count = int(input())
ar = list(map(int, input().rstrip().split()))
result = simpleArraySum(ar)
fptr.write(str(result) + '\n')
fptr.close()
[HackerRank] Diagonal Difference (Algorithm) (0) | 2021.01.05 |
---|---|
[HackerRank] A Very Big Sum (Algorithm) (0) | 2021.01.05 |
[HackerRank] Compare the Triplets (Algorithm) (0) | 2021.01.04 |
[HackerRank] Arrays - DS (Data Structure) (0) | 2021.01.04 |
[Leet Code] 1-bit and 2-bit Characters (python3) (0) | 2020.03.25 |