본문 바로가기
Algorithm

[구현/수학] 백준 4714 Lunacy - 파이썬(Python)

by jangThang 2023. 1. 2.
반응형

백준 온라인 저지

 

[ Contents ]

     

     

    1. 문제 (링크 참조)

     

    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

     

     

     

    2. 문제 풀이

     0.167를 곱해서, 달에서의 중력을 구하는 문제입니다.

     

     

     

    3. 코드

    while True:
        x = float(input())
        if x < 0:
            break
        print(f"Objects weighing {x:0.2f} on Earth will weigh {x*0.167:0.2f} on the moon.")

     

     

    star가 되고나서 Tistory

    반응형

    댓글