코딩테스트 파이썬/파이썬 프로그래머스 1단계
Softeer 연습문제(1단계) - 위험한 효도
세용용용용
2024. 6. 23. 20:57
Candidate | Softeer Assessment UI
softeer.ai
나의 풀이
import sys
input=sys.stdin.readline
# 걸리는 시간 계산 하는 함수
def gogo(back_time, front_time, lenth):
answer=0
now_time=0
while True:
answer+=1
now_time+=1
if now_time==lenth:
break
if now_time%back_time==0:
answer+=front_time
return answer
def solution(info_list):
answer=0
time_1, time_2, total_len = info_list
answer+=gogo(time_1, time_2, total_len)
answer+=gogo(time_2, time_1, total_len)
return answer
print(solution(list(map(int,input().split()))))