-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBEE-3412.cpp
More file actions
46 lines (37 loc) · 711 Bytes
/
Copy pathBEE-3412.cpp
File metadata and controls
46 lines (37 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <algorithm>
using namespace std;
int main()
{
int n;
cin >> n;
while (n-- > 0)
{
string name;
getline(cin >> ws, name);
string scores;
getline(cin, scores);
istringstream is(scores);
int qtt = 0;
float sum = 0;
float lowest = 10.0;
float score;
while (is >> score)
{
sum += score;
lowest = min(score, lowest);
qtt++;
}
if (qtt == 4)
{
sum -= lowest;
qtt--;
}
float grade = sum / max(2, qtt);
cout << name << ": " << fixed << setprecision(1) << grade << "\n";
}
return 0;
}