728x90
9161번: Sir Bedavere’s Bogus Division Solutions
The wise Sir Bedavere often uses non-standard logic, yet achieves positive results. Well, it seems he has been at it again, this time with division. He has determined that canceling the common digit of a numerator and denominator produces the correct answe
www.acmicpc.net
문제 풀이
두 세 자리의 수 x, y가 있을 때, x의 일의 자리 수와 y의 백의 자리 수가 같을 경우, 두 수를 제거해서 출력해주면 된다.
정답 코드
for i in range(10, 100) :
for j in range(1, 10) :
for k in range(10, 100) :
x = i * 10 + j
y = j * 100 + k
if (x / y == i / k and (x != y or i != k)) :
print(f"{x} / {y} = {i} / {k}")
728x90
'Algorithm > PS' 카테고리의 다른 글
[BOJ/백준] 9288 - More Dice [python] (0) | 2023.03.24 |
---|---|
[BOJ/백준] 9286 - Gradabase [python] (0) | 2023.03.24 |
[BOJ/백준] 9094 - 수학적 호기심 [python] (0) | 2023.03.24 |
[BOJ/백준] 9085 - 더하기 [python] (0) | 2023.03.23 |
[BOJ/백준] 9063 - 대지 [python] (0) | 2023.03.23 |