题解 | 学生综合评估系统
学生综合评估系统
https://www.nowcoder.com/practice/d8d5d6294b8f48b684ea93fbb4935a2b
#include<bits/stdc++.h>
#include <cstdio>
using namespace std;
// 定义学生结构体
struct Student{
int id;
int academic_score;
int activity_score;
};
// 评估函数:判断学生是否优秀
bool isExcellent(Student student){
// TODO: 实现优秀标准的判断逻辑
int total = student.academic_score + student.activity_score;
double weighted_score = student.academic_score * 0.7 + student.activity_score * 0.3;
// 优秀标准:总分>140 且 加权分>=80
if (total > 140 && weighted_score >= 80) {
return true;
} else {
return false;
}
return true; //true 代表学生优秀
}
//主函数用于读入数据调用函数,请勿修改
int main(){
int n;
cin >> n;
Student student;
for(int i=1;i<=n;i++){
cin >> student.id >> student.academic_score >> student.activity_score;
if (isExcellent(student)) cout << "Excellent\n";
else cout << "Not excellent\n";
}
return 0;
}
