parent
79aa3d9ae7
commit
d831152b3e
@ -1,22 +1,30 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
int k;
|
||||
string kill(string s) {
|
||||
int p = 0;
|
||||
for (int i = 0; i < s.size() - 1; i++)
|
||||
if (s[i + 1] > s[i]) {
|
||||
p = i;
|
||||
break;
|
||||
}
|
||||
string res;
|
||||
for (int i = 0; i < s.size(); i++)
|
||||
if (i != p) res += s[i];
|
||||
return res;
|
||||
}
|
||||
const int N = 110;
|
||||
|
||||
struct Node {
|
||||
int id;
|
||||
int score;
|
||||
const bool operator<(const Node &t) {
|
||||
if (score == t.score) return id < t.id;
|
||||
return score > t.score;
|
||||
}
|
||||
} a[N];
|
||||
/*
|
||||
3
|
||||
3 84
|
||||
1 87
|
||||
2 84
|
||||
*/
|
||||
int main() {
|
||||
string s;
|
||||
cin >> s >> k;
|
||||
for (int i = 1; i <= k; i++) s = kill(s);
|
||||
cout << s;
|
||||
int n;
|
||||
cin >> n;
|
||||
for (int i = 1; i <= n; i++)
|
||||
cin >> a[i].id >> a[i].score;
|
||||
|
||||
sort(a + 1, a + 1 + n);
|
||||
|
||||
for (int i = 1; i <= n; i++)
|
||||
cout << a[i].id << " " << a[i].score << endl;
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
const int N=110;
|
||||
struct Node {
|
||||
int id;
|
||||
int fen;
|
||||
bool operator<(const Node &t) {
|
||||
if (fen == t.fen) return id < t.id;
|
||||
return fen > t.fen;
|
||||
}
|
||||
} a[N];
|
||||
|
||||
|
||||
int main() {
|
||||
int n;
|
||||
cin >> n;
|
||||
for (int i = 1; i <= n; i++) cin >> a[i].id >> a[i].fen;
|
||||
sort(a+1, a + n+1);
|
||||
for (int i = 1; i <= n; i++) cout << a[i].id << " " << a[i].fen << endl;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in new issue