Skip to content

Instantly share code, notes, and snippets.

@ShinJJang
Created January 4, 2020 08:20
Show Gist options
  • Save ShinJJang/520e82a6eb5eaa63d10fb929f269a230 to your computer and use it in GitHub Desktop.
Save ShinJJang/520e82a6eb5eaa63d10fb929f269a230 to your computer and use it in GitHub Desktop.
import math
def solution(progresses, speeds):
days = []
for idx in range(len(progresses)):
day = math.ceil((100 - progresses[idx]) / speeds[idx])
days.append(day)
result = []
max_day = days[0]
count = 0
for day in days:
# print(idx, days, max_day, count)
if day > max_day:
max_day = day
result.append(count)
count = 1
else:
count += 1
result.append(count)
return result
@ShinJJang
Copy link
Author

다른 사람의 풀이를 보고 인상 깊었던 것

Q.append([-((p-100)//s),1])

math.ceil 없이 올림을 쓰려고 한거 같네요.

  • (p-100) => 음수
  • (p-100) // s => 내림한 음수(음수에서 내림은 절대값은 커짐)
  • -((p-100)//s) => 올림한 양수

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment