-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBOJ1138.java
More file actions
28 lines (27 loc) · 930 Bytes
/
BOJ1138.java
File metadata and controls
28 lines (27 loc) · 930 Bytes
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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class BOJ1138 {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
int[] arr = new int[N];
StringTokenizer st = new StringTokenizer(br.readLine());
for(int i = 1 ; i <= N ; i++){
int ex = Integer.parseInt(st.nextToken());
int cnt = 0;
for(int j = 0 ; j < N ; j++){
if(cnt == ex && arr[j] == 0) {
arr[j] = i;
break;
}else if(arr[j] == 0){
cnt++;
}
}
}
for(int x : arr){
System.out.print(x + " ");
}
}
}