Algorithm/PS
[BOJ/백준] 9317 - Monitor DPI [python]
chanwoong1
2023. 3. 24. 20:32
728x90
9317번: Monitor DPI
Each input line will have 3 numbers, the decimal value D, the integer value \(\text{Resolution}_{\text{Horizontal}}\), and the integer value \(\text{Resolution}_{\text{Vertical}}\). An input line of three zeroes will signify end of input
www.acmicpc.net
문제 풀이
입력값을 받고, 문제에 나오는 공식을 적용해 출력해주면 된다.
정답 코드
while True :
D, RH, RV = map(float, input().split())
if D == RH == RV == 0 : break
W = 16 * D / (337 ** 0.5)
H = 9 * W / 16
print("Horizontal DPI: {:.2f}".format(RH / W))
print("Vertical DPI: {:.2f}".format(RV / H))
728x90