Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 |
30 | 31 |
Tags
- 편스토랑 우승상품
- 더현대서울 맛집
- 프로그래머스 파이썬
- leetcode
- Kaggle
- 자연어처리
- 백준
- 데이콘
- SW Expert Academy
- Git
- 캐치카페
- 프로그래머스
- ubuntu
- ChatGPT
- github
- dacon
- 맥북
- Baekjoon
- PYTHON
- 금융문자분석경진대회
- Docker
- programmers
- hackerrank
- 편스토랑
- AI 경진대회
- Real or Not? NLP with Disaster Tweets
- gs25
- 파이썬
- 우분투
- 코로나19
Archives
- Today
- Total
솜씨좋은장씨
[BaekJoon] 1267번 : 핸드폰 요금 (Python) 본문
728x90
반응형
코딩 1일 1문제! 오늘의 문제는 백준의 핸드폰 요금 입니다.
1267번: 핸드폰 요금
동호가 저번 달에 이용한 통화의 개수 N이 주어진다. N은 20보다 작거나 같은 자연수이다. 둘째 줄에 통화 시간 N개가 주어진다. 통화 시간은 10,000보다 작거나 같은 자연수이다.
www.acmicpc.net
👨🏻💻 코드 ( Solution )
def minsik_plan(call_time):
fee = 0
if call_time < 60:
fee = 15
elif 60 <= call_time < 120:
fee = 30
else:
fee = (call_time // 60) * 15 + 15
return fee
def youngsik_plan(call_time):
fee = 0
if call_time < 30:
fee = 10
elif 30 <= call_time < 60:
fee = 20
else:
fee = (call_time // 30) * 10 + 10
return fee
def compare_plan(youngsik_plan_fee, minsik_plan_fee):
result = ""
if youngsik_plan_fee == minsik_plan_fee:
result = f"Y M {youngsik_plan_fee}"
elif youngsik_plan_fee < minsik_plan_fee:
result = f"Y {youngsik_plan_fee}"
else:
result = f"M {minsik_plan_fee}"
return result
def choice_plan(N, call_time_list):
youngsik_plan_fee, minsik_plan_fee = 0, 0
for call_time in call_time_list:
youngsik_plan_fee += youngsik_plan(call_time)
minsik_plan_fee += minsik_plan(call_time)
return compare_plan(youngsik_plan_fee, minsik_plan_fee)
if __name__ == "__main__":
N = int(input())
call_time_list = list(map(int, input().split()))
print(choice_plan(N, call_time_list))
GitHub - SOMJANG/CODINGTEST_PRACTICE: 1일 1문제 since 2020.02.07
1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub.
github.com
'Programming > 코딩 1일 1문제' 카테고리의 다른 글
[BaekJoon] 4150번 : 피보나치 수 (Python) (0) | 2022.05.20 |
---|---|
[BaekJoon] 23234번 : The World Responds (Python) (0) | 2022.05.19 |
[BaekJoon] 4821번 : 페이지 세기 (Python) (0) | 2022.05.17 |
[BaekJoon] 15680번 : 연세대학교 (Python) (0) | 2022.05.16 |
[BaekJoon] 13866번 : 팀 나누기 (Python) (0) | 2022.05.15 |
Comments