728x90
문제 : https://school.programmers.co.kr/learn/courses/30/lessons/150370
난이도 : Lv.1
풀이
def solution(today, terms, privacies):
answer = []
termsDict = {t.split(" ")[0] : int(t.split(" ")[1])*28 for t in terms}
td = today.split(".")
tdDays = 12*28*int(td[0]) + 28*int(td[1]) + int(td[2])
for i,p in enumerate(privacies):
diff = termsDict[p[-1]]
p = p[:-2]
pDays = 12*28*int(p.split(".")[0]) + 28 * int(p.split(".")[1]) + int(p.split(".")[2])
if tdDays - pDays >= diff:
answer.append(i+1)
return answer
728x90