[Week 1] FESTIVAL self review - weon136
Closed this issue · 0 comments
weon136 commented
FESTIVAL self review
코드 설명
case = int(input(""))
for k in range(case):
#input 받기
Nday, Lteam = input("").split()
Nday = int(Nday)
Lteam = int(Lteam)
cost = input("")
#Nday는 지속적으로 감소
costs = []
while Nday < Lteam :
#시작하는 일자
for i in range (0, Lteam+1):
#for문 완료 시 Nday를 하루씩 감소하여 오류가 나지 않게 한다.
Nday = Nday - 1
totalcost = 0
#한 회전 (ex. 첫번째 -> 3,4,5,6일 경우)
while Lteam <= Nday :
#내부 회전 (ex. 3일일 경우 -> 0:4)
for j in range (i, Nday-Lteam+1):
totalcost += cost[j]
costs = costs + (totalcost / Lteam)
result = min(costs)
print(result)
- case만큼 질문받은 후 결과를 출력하는 문제입니다.
- 반복문 구조가 꼬였습니다.