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 |
Tags
- 프로그래머스 파이썬
- 파이썬
- leetcode
- ubuntu
- Docker
- SW Expert Academy
- 우분투
- 편스토랑 우승상품
- 맥북
- 자연어처리
- github
- 캐치카페
- 편스토랑
- dacon
- AI 경진대회
- 데이콘
- 프로그래머스
- gs25
- ChatGPT
- Real or Not? NLP with Disaster Tweets
- Baekjoon
- Kaggle
- 백준
- hackerrank
- PYTHON
- 금융문자분석경진대회
- 코로나19
- 더현대서울 맛집
- programmers
- Git
Archives
- Today
- Total
솜씨좋은장씨
[BaekJoon] 4714번 : Lunacy (Python) 본문
728x90
반응형

코딩 1일 1문제! 오늘의 문제는 백준의 Lunacy 입니다.
4714번: Lunacy
After several months struggling with a diet, Jack has become obsessed with the idea of weighing less. In an odd way, he finds it very comforting to think that, if he had simply had the luck to be born on a different planet, his weight could be considerably
www.acmicpc.net
👨🏻💻 코드 ( Solution )
def lunacy(weight):
lunacy_weight = round(weight * 0.167, 2)
return lunacy_weight
def convert_weight_to_answer_format(weight):
return "%.2f"%weight
def convert_str_to_answer_format(weight, lunacy_weight):
return f"Objects weighing {weight} on Earth will weigh {lunacy_weight} on the moon."
if __name__ == "__main__":
while True:
weight = float(input())
if weight == -1.0:
break
lunacy_weight = lunacy(weight=weight)
weight = convert_weight_to_answer_format(weight=weight)
lunacy_weight = convert_weight_to_answer_format(weight=lunacy_weight)
print(convert_str_to_answer_format(weight=weight, lunacy_weight=lunacy_weight))
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] 23825번 : SASA 모형을 만들어보자 (Python) (0) | 2022.08.29 |
---|---|
[BaekJoon] 2999번 : 비밀 이메일 (Python) (0) | 2022.08.25 |
[BaekJoon] 6778번 : Which Alien? (Python) (0) | 2022.08.23 |
[BaekJoon] 11784번 : Hex Code (Python) (0) | 2022.08.22 |
[BaekJoon] 15792번 : A/B - 2 (Python) (0) | 2022.08.21 |