文章
84
粉丝
408
获赞
33
访问
877.1k
注意输入输出格式
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
typedef struct Node{
string sno;
string cname;
string name;
double grade[3];
double ave;
}node;
int main()
{
int N;
cin >> N;
vector<node> vstu;
for (int i = 0; i < N; i++) {
node stu;
cin >> stu.sno >> stu.cname >> stu.name;
double sum = 0;
for (int j = 0; j < 3; j++) {
cin >> stu.grade[j];
sum += stu.grade[j];
}
stu.ave = sum / 3.0;
vstu.push_back(stu);
}
double max = 0;
int index = -1;
for (int i = 0; i < N; i++) {
cout << vstu[i].name;
printf(" %.1f\n", vstu[i].ave);
if (vstu[i].ave > max) {
max = vstu[i].ave;
index = i;
}
}
cout << vstu[index].sno << " " << vstu[index].cname << " " << vstu[index].name << " ";
for (int i = 0; i < 3; i++) {
printf("%.1f ", vstu[index].grade[i]);
}
printf("%....
登录后发布评论
暂无评论,来抢沙发