Gửi bài giải
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
256M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
Bờm is studying sea levels on the planet Quạt Mo. After many days of observation, Bờm notices that the sea level on any given day is the average of the sea levels on the previous and the following day. Based on Bờm's recordings of the sea levels for the first two days, calculate the sea level on the ~N~-th day.
Input
- Only ~1~ line: Contains 2 integers ~a, b~ which are the sea levels for the first two days and an integer ~N~ ~(a, b, N \leq 10^9)~.
- The value ~a~ is the sea level on the first day, and ~b~ is the sea level on the second day.
Output
- The sea level on the ~N~-th day.
Sample Input
1 2 3
Sample Output
3
Bình luận