전공/백준
1476
yha97
2022. 11. 20. 16:10
날짜 : 2022. 11. 20
사용 언어 : python
문제
코드
import sys
e, s, m = map(int, sys.stdin.readline().split())
my_e, my_s, my_m = 1, 1, 1
cnt = 1
while True:
if my_e == e and my_s == s and my_m == m: break
my_e = (my_e) % 15 + 1
my_s = (my_s) % 28 + 1
my_m = (my_m) % 19 + 1
cnt += 1
print(cnt)
풀이
- 각 범위에 맞게 나머지를 구한 후 1을 더해준다(순서가 다른 경우 0 ~ 범위-1 값 도출)
알게된 점
-
참고 사이트
-