본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 25084번 Infinity Area

by 현장 2024. 12. 19.

-Code

from math import pi

for t in range(1, int(input()) + 1):
    r, a, b = map(int, input().split())
    res = 0

    while r > 0:
        res += pi * (r ** 2)
        r *= a
        res += pi * (r ** 2)
        r //= b

    print(f"Case #{t}: {res:.6f}")