#P5706. 【深基2.例8】再分肥宅水
【深基2.例8】再分肥宅水
Sharing the Soda
Problem Source
Luogu P5706
Problem Description
Now there are millilitres of soda to be shared equally among classmates. Each classmate needs cups. You need to find out how many millilitres of drink each classmate gets (strictly to 3 decimal places), and how many cups are needed in total.
Input Format
One real number and one positive integer , separated by a space.
Output Format
Output two lines.
The first line outputs a number with 3 decimal places: the amount of drink each classmate gets. The second line outputs a positive integer: the total number of cups needed.
Sample Input
500.0 3
Sample Output
166.667
6
Hint
- A single line mixes a decimal and an integer;
cincan tell them apart automatically, but you must pick the right type for each variable yourself. - "How much each person gets" is a division whose result is a decimal — think about what type the dividend should be.
- Keeping 3 decimal places needs format control (
fixedandsetprecision, from the header<iomanip>). - The output is two lines: the first line is the amount per person, the second line is the number of cups.
- Check against the sample:
500.0 3→ first line166.667, second line6.
For all data, with at most decimal places, and .