> 알고리즘 문제 풀이/BOJ
10539-수빈이와 수열 (python, 파이썬)
bky373
2020. 10. 14. 20:42
n = int(input())
array = list(map(int, input().split()))
result = []
for x in range(n):
result.append((x+1)*array[x]-sum(result[:x]))
print(' '.join([str(n) for n in result]))
- 데이터가 많아지면 append를 사용하지 않고, 리스트를 미리 만들어 인덱스별로 할당하는 게 낫다