알고리즘/브루트포스

[백준] 1476번 : 날짜 계산 풀이(python)

helloJosh 2023. 10. 11. 15:19

✅문제

출처:백준

✅문제 풀이 

가능한 경우의 수 전부해본다.
15*28*29 = 7980의 경우의 수가 나오기 때문에 충분하다.

✅Code

import sys
#sys.stdin = open('D:/test.txt', 'r')

E,S,M = map(int,input().split())
e,s,m = 1,1,1
cnt = 1
while True:
    if e == E and s == S and m == M:
        print(cnt)
        break
    e += 1
    s += 1
    m += 1
    if e == 16:
        e = 1
    if s == 29:
        s = 1
    if m == 20:
        m = 1
    cnt += 1