606. Average 1
Read the values of two floating-point numbers A and B, corresponding to the results of the two students.
Please calculate the average score of the students, where the weight of A's grade is 3.5, and the weight of B's grade is 7.5.
The value range of the score is between 0 and 10, and all of them are kept to one decimal place.
Input format
The input occupies two lines, each line contains a floating-point number, the first line represents A, and the second line represents B.
Output format
The output format is "MEDIA = X", where X is the average score, and the result is to five decimal places.
data range
0≤A,B≤10.0
Input sample:
5.0
7.1
Sample output:
MEDIA = 6.43182
//3.5 + 7.5可以放在最后整体除
#include <cstdio>
int main()
{
double a, b;
scanf("%lf%lf", &a, &b);
printf("MEDIA = %.5lf", a * 3.5 / (3.5 + 7.5) + b * 7.5 / (3.5 + 7.5));
return 0;
}