VioletaBabel

2605번: 줄 세우기 본문

백준/백준-C++
2605번: 줄 세우기
Beabletoet 2018. 2. 5. 12:57
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include<cstdio>
#include<vector>
//#include<algorithm>
using namespace std;
#define swap(a,b) {int t;t=a;a=b;b=t;}
int main()
{
    int n, ans[100], s;
    scanf("%d"&n);
    for (int i = 0; i < n; ++i)
    {
        ans[i] = i + 1;
        scanf("%d"&s);
        for (int j = i; s > 0--s, --j)
            swap(ans[j], ans[j - 1]);
    }
    for (int i = 0; i < n; ++i)
        printf("%d ", ans[i]);
}
cs


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

10026번: 적록색약  (0) 2018.02.05
11659번: 구간 합 구하기  (0) 2018.02.05
2445번: 별찍기 - 8  (0) 2018.02.05
1920번: 수 찾기  (0) 2017.09.15
2443번: 별찍기 - 6  (0) 2017.09.15
Comments