AcWing 661. 平均数3
原题链接
中等
作者:
Value
,
2020-09-09 08:09:54
,
所有人可见
,
阅读 447
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
double tmp, avg = 0;
double w[4] = {2, 3, 4, 1};
for(int i = 0; i < 4; i ++ ){
cin >> tmp;
avg += tmp * w[i];
}
avg /= 10;
printf("Media: %.1lf\n", avg);
if(avg >= 7) cout << "Aluno aprovado." << endl;
else if(avg < 5) cout << "Aluno reprovado." << endl;
else{
cout << "Aluno em exame." << endl;
cin >> tmp;
printf("Nota do exame: %.1lf\n", tmp);
avg = (avg + tmp) / 2;
if(avg >= 5) cout << "Aluno aprovado." << endl;
else cout << "Aluno reprovado." << endl;
printf("Media final: %.1lf\n", avg);
}
return 0;
}