# 成绩统计（蓝桥杯）

### 题目

2

yx1 1 45 67 87

yx2 2 88 90 99

yx2

yx1

#include <bits/stdc++.h>
using namespace std;

int main()
{
struct student
{
string xm;
int xh;
double yy;
double sx;
double cpp;
};
student a[1000];
int n;
double sum = 0, min = 301, max = 0;
string mins, maxs;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> a[i].xm >> a[i].xh >> a[i].yy >> a[i].sx >> a[i].cpp;
sum = a[i].yy + a[i].sx + a[i].cpp;
__________________;
}
cout << maxs << endl
<< mins;
return 0;
}

### 代码

#include <bits/stdc++.h>
using namespace std;

int main()
{
struct student
{
string xm;
int xh;
double yy;
double sx;
double cpp;
};
student a[1000];
int n;
double sum = 0, min = 301, max = 0;
string mins, maxs;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> a[i].xm >> a[i].xh >> a[i].yy >> a[i].sx >> a[i].cpp;
sum = a[i].yy + a[i].sx + a[i].cpp;
if (min > sum)
{
min = sum;
mins = a[i].xm;
}
if (max < sum)
{
max = sum;
maxs = a[i].xm;
}
}
cout << maxs << endl
<< mins;
return 0;
}

|
4天前
|
Java C语言 C++

26 0
|
4天前
|

23 0
|
4天前
|
Java 程序员 C++

31 1
|
4天前
|
C++

23 0
|
8月前
|

27 0
|
11月前
|

60 0
|
11月前
|

88 0
|
11月前
|

70 0
|
11月前
|

[蓝桥杯 2022 省 B] 刷题统计
[蓝桥杯 2022 省 B] 刷题统计
54 0
|
11月前
|

[蓝桥杯 2018 省 B] 日志统计——双指针算法
[蓝桥杯 2018 省 B] 日志统计——双指针算法
57 0