VioletaBabel

10814번: 나이순 정렬 본문

백준/백준-C++
10814번: 나이순 정렬
Beabletoet 2017. 6. 11. 13:36

#include<cstdio>

#include<algorithm>

#include<cstring>

using namespace std;

struct mem

{

int a;

char b[101];

};

bool compare(const mem &one, const mem &two)

{

return one.a < two.a;

}

int main()

{

int n;

scanf("%d", &n);

mem ber[100000];

for (int i = 0; i < n; ++i)

scanf("%d %s", &ber[i].a, &ber[i].b);

stable_sort(&ber[0], &ber[n], compare);

for (int i = 0; i < n; ++i)

printf("%d %s\n", ber[i].a, ber[i].b);

}

'백준 > 백준-C++' 카테고리의 다른 글

10799번: 쇠막대기  (0) 2017.06.11
10818번: 최소, 최대  (0) 2017.06.11
10825번: 국영수  (0) 2017.06.11
1181번: 단어 정렬  (0) 2017.06.11
11651번: 좌표 정렬하기 2  (0) 2017.06.11
Comments