
    アクセス: private     閲覧数: 0    
00.00 sec    752 KB    41 lines     491 bytes    2015-05-29 10:16
?
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
	
#include<stdio.h>
#include<stdlib.h>
#define N 20000
#define K 10000
 
int main(){
  int n,i;
  int A[N],B[N],C[K];
 
  scanf("%d",&n);
 
 
  for( i=0 ; i<=K ; i++){
    C[i]=0;
  }
 
  for( i=0 ; i<n ; i++ ){
   scanf("%d",&A[i]);
    C[A[i]]++;
  }
 
  for( i=1 ; i<=K ; i++){
    C[i] = C[i] + C[i-1];
  }
 
  for( i=n ; i>=0 ; i-- ){
    B[C[A[i]]] = A[i];
    C[A[i]]--;
  }
  
   for ( i=1 ; i<=n ; i++ ){
   if(i > 1) printf(" ");
     printf("%d",B[i]);
  }
 
  printf("\n");
 
  return 0;
}
Compile Error Logs: