Resource limit
Time limit: 1.0s Memory limit: 256.0MB
Problem description In the
past, there was a monkey who ate buns very well. It could eat countless buns. However, it eats different buns at different speeds; meat buns eat x per second L; leeks buns eat y per second; unstuffed buns eat z per second; now there are x1 meat buns, y1 leek buns, z1 unstuffed buns; Q: How long will it take for monkeys to eat these buns ? The result retains p decimal places.
Input format
Enter 1 line, containing 7 integers, respectively representing the speed of eating different buns, the number of different buns and the number of reserved bits.
Output format
Output one line, containing 1 real number, indicating the time to finish eating all the buns.
Sample input
4 3 2 20 30 15 2
Sample output
22.50
Data size and convention
0 <x <100; 0 <y <100; 0 <z <100; 0 <x1 <= 1000000; 0 <y1 <= 10000000; 0 <z1 <= 10000000; 0 <p <= 1000
#include <iostream>
using namespace std;
int main()
{
double count=0, x, y, z, x1, y1, z1;
int p;
cin >> x >> y >> z >> x1 >> y1 >> z1 >> p;
count = x1 / x + y1 / y + z1 / z;
printf("%.*f",p, count);//p就是*,当要保留的小数位数为变量时用*号代替
return 0;
}