꾸준히 합시다

백준 파이썬 4714번: Lunacy 본문

코딩 테스트 문제 풀이

백준 파이썬 4714번: Lunacy

tturbo0824 2021. 6. 11. 12:53

https://www.acmicpc.net/problem/4714

 

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 1

while True:
    weight = float(input())
    
    if weight == -1.0:
        break
        
    print("Objects weighing %.2f on Earth will weigh %.2f on the moon." % (weight, weight * 0.167))

인풋으로 주어진 지구에서의 무게에 0.167를 곱해 달에서의 무게로 변환하면 되는 단순 구현 문제.

 

하나 염두해야 할 점은 소수점 두 자리까지만 출력해야 한다는 것이다.

Comments