[ํ๋ก๊ทธ๋๋จธ์ค-Lv2] ๊ธฐ๋ฅ๊ฐ๋ฐ
๐ Problem Solving/Programmers
import sys
input = sys.stdin.readline
progresses = list(map(int, input().split()))
speeds = list(map(int, input().split()))
def solution(progresses, speeds):
answer = []
while len(progresses) > 0:
for i in range(len(progresses)):
progresses[i] += speeds[i]
if progresses[0] >= 100:
cnt = 0
while len(progresses) > 0 and progresses[0] >= 100:
progresses.pop(0)
speeds.pop(0)
cnt += 1
answer.append(cnt)
return answer
print(solution(progresses, speeds))
ํด์ค
progresses์ ๊ฐ์ speeds์ ๊ฐ๋งํผ ๋ํด์ค๋ค.
progresses์ ์ฒซ ๋ฒ์งธ ๊ฐ์ด 100 ์ด์์ด๋ฉด ์ฒซ ๋ฒ์งธ ๊ฐ์ด 100๋ณด๋ค ์์ ๋๊น์ง pop์ ์์ผ์ฃผ๊ณ , ๊ทธ ํ์๋ฅผ answer์ ์ ์ฅํ๋ค.
'๐ Problem Solving > Programmers' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค-Lv2] ํ๊ฒ ๋๋ฒ / Python (0) | 2021.06.02 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค-Lv2] ๋ ๋งต๊ฒ / Python (0) | 2021.06.02 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] [1์ฐจ] ๋น๋ฐ์ง๋ / Python (0) | 2021.06.02 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ๋ ๊ฐ ๋ฝ์์ ๋ํ๊ธฐ / Python (0) | 2021.06.02 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] 3์ง๋ฒ ๋ค์ง๊ธฐ / Python (0) | 2021.06.02 |