Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- Vue
- vuejs
- DFS와BFS
- cos
- 파이썬
- Algorithm
- 코테
- C++
- 분할정복
- django
- cos pro 1급
- AndroidStudio
- codingtest
- android
- 코드품앗이
- 동적계획법과최단거리역추적
- 알고리즘
- DFS
- 개발
- cos pro
- 안드로이드스튜디오
- BAEKJOON
- 코딩테스트
- 동적계획법
- 백준
- Flutter
- Python
- 안드로이드
- issue
- DART
Archives
- Today
- Total
Development Artist
[COS Pro 1급, Python] 4차 3번 : 스키장 최소 비용 구하기 본문
728x90
반응형
문제 유형
한줄 수정
난이도
easy
Note
Nothing
Code
# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
# 4차 3번
def solution(one_day_price, multi_day, multi_day_price, n):
if one_day_price * multi_day <= multi_day_price:
return n * one_day_price
else:
return (n // multi_day) * multi_day_price + (n % multi_day) * one_day_price
one_day_price1 = 3
multi_day1 = 5
multi_day_price1 = 14
n1 = 6
ret1 = solution(one_day_price1, multi_day1, multi_day_price1, n1)
print("solution 함수의 반환 값은", ret1, "입니다.")
one_day_price2 = 2
multi_day2 = 3
multi_day_price2 = 5
n2 = 11
ret2 = solution(one_day_price2, multi_day2, multi_day_price2, n2)
print("solution 함수의 반환 값은", ret2, "입니다.")
※ 가끔 코드 중 print(~)가 있습니다. 정리 못한 점 죄송합니다.
728x90
반응형
'Algorithm > COS' 카테고리의 다른 글
[COS Pro 1급, Python] 4차 5번 : 규칙에 맞는 숫자 생성 (0) | 2022.02.25 |
---|---|
[COS Pro 1급, Python] 4차 4번 : 마방진 문제 (0) | 2022.02.25 |
[COS Pro 1급, Python] 4차 2번 : 문자열 압축 (0) | 2022.02.25 |
[COS Pro 1급, Python] 4차 1번 : 사전에서 단어찾기 (0) | 2022.02.25 |
[COS Pro 1급, Python] 3차 10번 : 밥먹고 머리자르고 (0) | 2022.02.25 |
Comments