728x90
반응형
단순 수학 문제이다.
from math import ceil
N, K = map(int, input().split())
for _ in range(K):
s, t, r = map(int, input().split())
c = s*t
res = cnt = 0
while 1:
if (N-cnt <= c):
res += ceil((N-cnt)/s)
break;
else:
cnt += c;
res += t+r;
print(res)
728x90
반응형
'Agorithm > 백준 알고리즘' 카테고리의 다른 글
백준 알고리즘 7595번 Triangles(python) (0) | 2021.02.15 |
---|---|
백준 알고리즘 6322번 직각 삼각형의 두 변(python) (0) | 2021.02.15 |
백준 알고리즘 6131번 완전 제곱수(python) (0) | 2021.02.15 |
백준 알고리즘 5751번 Head or Tail(python) (0) | 2021.02.15 |
백준 알고리즘 5717번 상근이의 친구들(python) (0) | 2021.02.15 |