Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7a89191

Browse files
uri
1 parent da1ded7 commit 7a89191

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

‎Online Judges/URI/2250.cpp

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#include <iostream>
2+
#include <vector>
3+
#include <algorithm>
4+
5+
using namespace std;
6+
7+
struct Player {
8+
int points;
9+
string name;
10+
11+
bool operator < (const Player& pp) {
12+
if (this->points > pp.points) {
13+
return true;
14+
} else if (pp.points == this->points) {
15+
if (this->name < pp.name)
16+
return true;
17+
}
18+
return false;
19+
}
20+
};
21+
22+
int main() {
23+
int n, x, mi, ma,t = 1;
24+
vector<Player>v;
25+
while(cin >> n && n) {
26+
v.assign(n, {0, ""});
27+
for (int i = 0; i < n; i++)
28+
{
29+
cin >> v[i].name;
30+
mi = 100000, ma = -1;
31+
for (int j = 0; j < 12; j++)
32+
{
33+
cin >> x;
34+
if (x < mi) mi = x;
35+
if (x > ma) ma = x;
36+
37+
v[i].points+=x;
38+
}
39+
v[i].points-=(mi+ma);
40+
}
41+
42+
sort(v.begin(), v.end());
43+
int rank = 1, pos = 1;
44+
cout << "Teste " << t++ << endl;
45+
for (int i = 0; i < n; i++)
46+
{
47+
if (i != 0) {
48+
rank++;
49+
if (v[i].points != v[i - 1].points) {
50+
pos = rank;
51+
}
52+
}
53+
54+
cout << pos << " " << v[i].points << " " << v[i].name << endl;
55+
}
56+
cout << endl;
57+
}
58+
return 0;
59+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /