You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
878 B
34 lines
878 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
const double eps = 1e-8;
|
|
|
|
int main() {
|
|
//思路1
|
|
for (int i = 1; i <= 150; i++) { //枚举数学与外语的成绩
|
|
for (int j = 1; j <= 150; j++) {
|
|
double p = 1.0 * (78 + 82 + 80 + 62 + 83 + i + j) / 7;
|
|
if (abs(i - 12 - p) < eps && abs(j - 8 - p) < eps) {
|
|
cout << p << endl;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
//思路2
|
|
//画图说明曲线问题,会很好理解
|
|
int a[] = {78, 82, 80, 62, 83};
|
|
for (int i = 1; i <= 150; i++) { //枚举平均分
|
|
int c = 0;
|
|
for (int j = 0; j < 5; j++) c += a[j] - i; //计算每科分数与平均分的差,再求和
|
|
c += 12;
|
|
c += 8;
|
|
if (c == 0) {
|
|
cout << i << endl;
|
|
break;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|