Submission #35712


ソースコード

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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include<stdio.h>
#include<math.h>
#include<string.h>
int main(){
int n;
scanf("%d", &n);
int cm[n];
int sorted[n];
int i = 0;
while(i < n){
sorted[n] = 0;
scanf("%d", &cm[i]);
i++;
}
int j;
sorted[0] = cm[0];
i = 1;
while(i < n){
if(sorted[i - 1] < cm[i]){
sorted[i] = cm[i];
}
else{
int j = i;
while(j > -1){
j--;
if(sorted[j - 1] < cm[i] || j == 0){
int temp[n];
int k = 0;
while(k < n){
temp[k] = sorted[k];
k++;
}
sorted[j] = cm[i];
while(j != n){
sorted[j + 1] = temp[j];
j++;
}
j = -1;
}
}
}
i++;
}
i = n - 1;
while(i > -1){
printf("%d\n", sorted[i]);
i--;
}
return 0;
}

ステータス

項目 データ
問題 0930 - 背の順
ユーザー名 r1825
投稿日時 2018-05-14 17:07:51
言語 C
状態 Accepted
得点 1
ソースコード長 797 Byte
最大実行時間 26 ms
最大メモリ使用量 448 KB

セット

セット 得点 Cases
1 ALL 1 / 1 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
rnd_1.txt AC 17 ms 380 KB
1
rnd_2.txt AC 19 ms 280 KB
1
rnd_3.txt AC 26 ms 336 KB
1
rnd_4.txt AC 16 ms 396 KB
1
rnd_5.txt AC 19 ms 448 KB
1
sample.txt AC 21 ms 376 KB
1