반응형
https://www.acmicpc.net/problem/1173
1173번: 운동
첫째 줄에 다섯 정수 N, m, M, T, R이 주어진다.
www.acmicpc.net
from sys import exit
N, m, M, T, R = map(int, input().split())
TOTAL_TIME = 0
EXERCISE_TIME = 0
health = m
if health + T > M:
print(-1)
exit()
while EXERCISE_TIME != N:
if health + T <= M:
health += T
EXERCISE_TIME += 1
TOTAL_TIME += 1
elif health + T > M:
health -= R
if health < m:
health = m
TOTAL_TIME += 1
print(TOTAL_TIME)
'알고리즘' 카테고리의 다른 글
1213번 팰린드롬 만들기 (0) | 2023.07.07 |
---|---|
1212번 8진수 2진수 (0) | 2023.07.07 |
1138번 한 줄로 서기 (0) | 2023.07.07 |
1076번 저항 (0) | 2023.07.07 |
1063번 킹 (0) | 2023.07.04 |