month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
day = [0 for i in range(366)]
check = []
count = 0
list = [[], [], [], []]
def changetoday(M):
global month
sum = 0
for i in range(M-1):
sum += month[i]
return sum
n = int(input())
for i in range(n):
sm, sd, em, ed = map(int, input().split())
list[0].append(sm)
list[1].append(sd)
list[2].append(em)
list[3].append(ed)
def ret(c) :
global n
global count
global check
if c > 334:
return count
count += 1
for i in range(n):
if changetoday(list[0][i])+list[1][i] < c:
check.append(i)
if len(check) == 0:
return 0
else:
m = 0
for i in range(len(check)):
s = changetoday(list[2][check[i]]) + list[3][check[i]]
if s > m:
m = s
k = i #
print(list[0][check[k]],"/",list[1][check[k]]," ~ ",list[2][check[k]],"/",list[3][check[k]]) #
return ret(m)
# \('^')/
# |||
# ` `
print(ret(60))
top of page
기능을 테스트하려면 라이브 사이트로 이동하세요.
2024
2024
댓글 1개
좋아요
댓글(1)
bottom of page
month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] day = [0 for i in range(366)] check = [] count = 0 list = [[], [], [], []] lm = 0 ld = 0 def changetoday(M): global month sum = 0 for i in range(M - 1): sum += month[i] return sum n = int(input()) for i in range(n): sm, sd, em, ed = map(int, input().split()) list[0].append(sm) list[1].append(sd) list[2].append(em) list[3].append(ed) def ret(c): global n global lm global ld global count global check if c > 334: return count count += 1 for i in range(n): if changetoday(list[0][i]) + list[1][i] <= c: check.append(i) if len(check) == 0: return 0 else: m = 0 for i in range(len(check)): s = changetoday(list[2][check[i]]) + list[3][check[i]] if s >= m: m = s k = i print(list[0][check[k]], "/", list[1][check[k]], " ~ ", list[2][check[k]], "/", list[3][check[k]]) # if i > 1 and len(check) > 1: if list[0][check[k]] == lm and list[1][check[k]] == ld: return 0 lm = list[0][check[k]] ld = list[1][check[k]] return ret(m) # \('^')/ # ||| # ` ` print( ret( 60))