728x90
반응형
단순 구현 문제이다.
while 1:
n = int(input())
if n == 0:
break
a, b, c = map(int, input().split())
if b-a == c-b:
d = b-a
print((n*(2*a + (n-1)*d)) // 2)
elif b/a == c/b:
r = b//a
print(a*(r**n - 1)//(r-1))
728x90
반응형
'Agorithm > 백준 알고리즘' 카테고리의 다른 글
백준 알고리즘 9325번 얼마?(python) (0) | 2021.02.20 |
---|---|
백준 알고리즘 9316번 Hello Judge(python) (0) | 2021.02.20 |
백준 알고리즘 9299번 Math Tutoring(python) (0) | 2021.02.20 |
백준 알고리즘 9298번 Ant Entrapment(python) (0) | 2021.02.20 |
백준 알고리즘 9297번 Reducing Improper Fractions(python) (0) | 2021.02.20 |