Lunacy
Time limit1sMemory limit128 MB
For each non-negative Earth weight read until a negative sentinel, print a sentence giving the weight on the Moon at 0.167 times the Earth weight, both rounded to two decimals.
- Level
Easy1 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
After months of struggling with a diet, Jack has become obsessed with the idea of weighing less. In an odd way, he finds it comforting to think that, had he simply been lucky enough to be born on a different planet, his weight could be considerably lower.
The planets are of course far out of reach, but even the Earth's Moon would produce a dramatic weight loss: an object on the Moon weighs only of its weight on Earth.
Input
The input consists of one or more lines. Each line contains a single floating-point number: a weight in pounds measured on Earth. The end of the input is marked by a negative floating-point number, which is not processed.
Output
For each weight in the input, print one line of the form
Objects weighing X on Earth will weigh Y on the moon.
where X is the weight from the input and Y is the corresponding weight on the Moon (). Print both numbers with exactly two digits after the decimal point.