ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

๋ฐ˜์‘ํ˜•

์ด ๋ฌธ์ œ๋Š” ๊ฝค ๊ฐ„๋‹จํ•˜๊ฒŒ ํ‹€์ด ์žกํ˜”๋‹ค.

from math import ceil


def solution(progresses, speeds):
    answer = []
    temp = 0
    task = 1
    for a, b in zip(progresses, speeds):
        day = ceil((100 - a) / b)
        if temp > day:
            task += 1
        else:
            answer.append(task)
            task = 1
            temp = day

    return answer


progresses = [93, 30, 55, 4]
speeds = [1, 30, 5, 95]

print(solution(progresses,speeds))

๋ฐ”๋กœ ๊ตฌํ˜„

 

๋–ผ์ž‰ ์‹คํŒจ

 

๋‹ค์‹œ ์ƒ๊ฐํ•ด๋ณด์ž

from math import ceil


def solution(progresses, speeds):
    answer = []
    temp = ceil((100-progresses[0])/speeds[0])
    task = 0
    for a, b in zip(progresses, speeds):
        day = ceil((100 - a) / b)

        if temp >= day:
            task += 1
        else:
            answer.append(task)
            temp = day
            task = 1
    answer.append(task)

    return answer


progresses = [93, 30, 55]
speeds = [1, 30, 5]

print(solution(progresses,speeds))

ํ—คใ…”ใ…”ใ…”ใ…”ใ…”ใ…”ใ…”ใ…”ํ—คํ—คํ—คํ—คํ—คํ—ค

 

 

 

์ฝ”๋“œ ๋ฆฌ๋ทฐ

์ดํ•ดํ•˜๊ธฐ ํž˜๋“  ๋ณ€์ˆ˜๋ช…์€ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š”๋‹ค. ๋ช…ํ™•ํ•œ ์˜๋ฏธ์˜ ๋ณ€์ˆ˜๋ช…์„ ์‚ฌ์šฉํ•˜์ž

ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ง€์šด๋‹ค.

// ์˜คํผ๋ ˆ์ดํ„ฐ๋Š”....?

๋ฐ˜์‘ํ˜•
๋Œ“๊ธ€