백준/구현
# 1476번 : 날짜
bright_code
2020. 10. 15. 21:46
728x90
반응형
# (1 ≤ E ≤ 15, 1 ≤ S ≤ 28, 1 ≤ M ≤ 19)
year = list(map(int,input().split()))
for result in range(1,7981):
if result % 15 == year[0] or ( result%15 == 0 and year[0] == 15 ) :
if result % 28 == year[1] or (result%28 == 0 and year[1] == 28 ) :
if result % 19 == year[2] or ( result%19 == 0 and year[2] == 19) :
print(result)
문제에 보면 주어진 시간이 2초로 긴 편이다.
완전 탐색으로 접근해서 풀어도 무방하다.
주의! 15/28/19 로 나누어 떨어지면 나머지는 0 이지만 표현되는 수는 15 임을 조심!
728x90
반응형