합
- 제목
Final Price
- 조건
시간 제한 : 2 초
메모리 제한 : 1024 MB
- 문제
Neverland has recently experienced a rapid rise in the inflation rate. The value of money is continuously decreasing, and citizens’ purchasing power is lowered daily. The government is trying to control the inflation rate by testing various methods, such as reducing the amount of money in the economy by increasing interest rates and promoting investment, even in purchasing cars to be delivered in an unforeseeable future.
Despite these efforts, the inflation rate is still above 50%, and the prices are jumping up and down drastically every now and then. The Statistical Center of Neverland provides detailed information on the inflation rate and the average price change over time for a basket of goods commonly purchased by households. However, it is hard to calculate the actual price of a specific good at a given point in time using that information.
The ICPC (International Center for Price Changes) is asking you to help the citizens of Neverland to calculate the prices for their desired goods after a specific period of time. The information provided to you is the initial price of a good at the start of a time period, and the daily price change for that good over the observed time period.
- 입력
The first input line contains an integer n (1 ⩽ n ⩽ 1000), indicating the number of days the prices are observed. The second line contains a positive integer indicating the initial price of the desired good on day 1. The next n − 1 lines contain n − 1 integers showing the daily change in the price of the good, in order from day 2 to day n. You can assume that the price of the good is always positive and never exceeds 1, 000, 000 in the observed period.
- 출력
In the output, print the final price of the good on day n.
예제 입력1 | 예제 출력1 |
2 11 68 |
79 |
예제 입력2 | 예제 출력2 |
4 110 -5 0 27 |
132 |
T = int(input())
nsum = 0
for _ in range(T):
nsum += int(input())
print(nsum)
'Problem Solving > BaekJoon' 카테고리의 다른 글
[BOJ/백준] 28281 - 선물 (0) | 2023.07.19 |
---|---|
[BOJ/백준] 15489 - 파스칼 삼각형 (0) | 2023.07.19 |
[BOJ/백준] 2206 - 벽 부수고 이동하기 (0) | 2023.07.19 |
[BOJ/백준] 1253 - 좋다 (0) | 2023.07.19 |
[BOJ/백준] 9656 - 돌 게임 2 (0) | 2023.07.19 |