-
Notifications
You must be signed in to change notification settings - Fork 0
/
c.cpp
68 lines (63 loc) · 1.64 KB
/
c.cpp
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <iostream>
#include <algorithm>
#include <list>
#include <vector>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> vec;
vector<int> v;
for (int i = 0; i < n; i++) {
vec.push_back(i + 1);
cout << vec[i];
}
for (int i = 0; i < n; i++) {
if (i == n - 1) {
i = 0;
}
if (v.size() == n)
break;
v.push_back(vec[k]);
vec.erase(vec.begin() + (k-1));
}
for (int i = 0; i < v.size();i++) {
if (i == 0)
cout << "<" << v[i] << ",";
else if (i == v.size()-1) cout << v[i] << ">";
else cout << v[i] << ",";
}
return 0;
}
//국영수
#include<ostream>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
static vector<pair<pair<string,int>,pair<int,int>>> v;
bool sorting(pair<pair<string,int>,pair<int,int>> a,pair<pair<string,int>,pair<int,int>> b) {
if (a.first.second == b.first.second){
if(a.second.first==b.second.first){
if(a.second.second==b.second.second){
return a.first.first<b.first.first;
}
return a.second.second>b.second.second;
}
return a.second.first<b.second.first;
}
return a.first.second > b.first.second;
}
int main() {
int n,k,e,m;
string name;
cin>>n;
for(int i=0;i<n;i++){
cin>>name>>k>>e>>m;
v.push_back(make_pair(make_pair(name,k),make_pair(e,m)));
}
sort(v.begin(),v.end(),sorting);
for(auto x:v)
cout<<x.first.first<<'\n';
return 0;
}