//https://www.acmicpc.net/problem/2605 #include <iostream> | |
#include <cstring> | |
using namespace std; | |
int students[101]; | |
int ans[101]; | |
int n; | |
void order(){ | |
int x; | |
cin >> n >> x; | |
ans[1]=1; | |
for(int i=2; i<=n; i++){ | |
cin >> x; | |
for(int j=i-1; j>=i-x; j--){ | |
ans[j+1]=ans[j]; | |
} | |
ans[i-x]=i; | |
} | |
} | |
void output(){ | |
for(int i=1; i<=n; i++) cout << ans[i] << " "; | |
} | |
int main(){ | |
order(); | |
output(); | |
} |
'알고리즘 문제 풀이 > 1DP_과제(~180615)' 카테고리의 다른 글
180227_10172_개 (0) | 2018.02.27 |
---|---|
180217_2660_회장뽑기 (0) | 2018.02.17 |
180215_10451_순열 사이클 (0) | 2018.02.15 |
180214_11568_민균이의 계략 (0) | 2018.02.14 |
180213_1563_개근상 (0) | 2018.02.13 |
//https://www.acmicpc.net/problem/2605 #include <iostream> | |
#include <cstring> | |
using namespace std; | |
int students[101]; | |
int ans[101]; | |
int n; | |
void order(){ | |
int x; | |
cin >> n >> x; | |
ans[1]=1; | |
for(int i=2; i<=n; i++){ | |
cin >> x; | |
for(int j=i-1; j>=i-x; j--){ | |
ans[j+1]=ans[j]; | |
} | |
ans[i-x]=i; | |
} | |
} | |
void output(){ | |
for(int i=1; i<=n; i++) cout << ans[i] << " "; | |
} | |
int main(){ | |
order(); | |
output(); | |
} |
'알고리즘 문제 풀이 > 1DP_과제(~180615)' 카테고리의 다른 글
180227_10172_개 (0) | 2018.02.27 |
---|---|
180217_2660_회장뽑기 (0) | 2018.02.17 |
180215_10451_순열 사이클 (0) | 2018.02.15 |
180214_11568_민균이의 계략 (0) | 2018.02.14 |
180213_1563_개근상 (0) | 2018.02.13 |