文章
55
粉丝
100
获赞
12
访问
29.8k
#include <iostream>
#include<string>
using namespace std;
struct student{
string id;
string banji;
string name;
float score[3];
};
int main(){
int n;
struct student stu[100];
cin>>n;
for(int i = 0; i<n; i++){
cin>>stu[i].id>>stu[i].banji>>stu[i].name;
for(int j = 0; j<3; j++){
cin>>stu[i].score[j];
}
}
struct student max = stu[0];
float da = 0;
for(int i = 0; i<n; i++){
float sum =0;
for(int j = 0; j<3; j++){
sum+=stu[i].score[j];
}
float avs = sum/3.0;
if(avs > (max.score[0]+max.score[1]+max.score[2])/3.0){
max = stu[i];
da = avs;
}
printf("%s %.1f\n",stu[i].name.c_str(),avs);
}
cout<<max.id<<" "<<max.banji<<" "<<max.name<<" ";
printf("%.1f %.1f %.1f %.1f",max.score[0],max.score[1],max.score[2],da);
}
登录后发布评论
暂无评论,来抢沙发