728x90
10185번: Focus
There is no longer a STAAR test in physics—the pressure is off! You can just learn physics for the sheer fun of learning about the natural world (and to prepare for college)! To celebrate this fact, here’s a program on lenses. Lenses use refraction of
www.acmicpc.net
문제 풀이
문제에 주어진 1/f = 1/p + 1/q를 통해 f를 구해주어야 한다. 이 식을 통해 f를 구해주면 f = pq / (p + q)이다.
정답 코드
for _ in range(int(input())) :
p, q = map(int, input().split())
print("f = {:.1f}".format(p * q / (p + q)))
728x90
'Algorithm > PS' 카테고리의 다른 글
[BOJ/백준] 10205 - 헤라클레스와 히드라 [python] (0) | 2023.03.28 |
---|---|
[BOJ/백준] 10187 - Golden [python] (0) | 2023.03.28 |
[BOJ/백준] 10180 - Ship Selection [python] (0) | 2023.03.28 |
[BOJ/백준] 10178 - 할로윈의 사탕 [python] (0) | 2023.03.28 |
[BOJ/백준] 9950 - Rectangles [python] (0) | 2023.03.28 |