Submission #36734


ソースコード

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
#include <stdio.h>
int main(){
int n, i;
scanf("%d", &n);
int height[n];
for(i = 0;i < n;i++){
scanf("%d", &height[i]);
}
int sorted[n];
for(i = 0;i < n;i++){
int temp = -1;
int j;
int id = 0;
for(j = 0;j < n;j++){
if(temp < height[j]){//もし、tempより大きければ
temp = height[j];//tempに代入
id = j;
}
}
height[id] = 0;//ループ中で最大だったところを0にする。
sorted[i] = temp;//代入することでソート完了
}
for(i = 0;i < n;i++){
printf("%d\n", sorted[i]);
}
return 0;
}

ステータス

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

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
rnd_1.txt AC 22 ms 380 KB
1
rnd_2.txt AC 24 ms 312 KB
1
rnd_3.txt AC 16 ms 340 KB
1
rnd_4.txt AC 18 ms 396 KB
1
rnd_5.txt AC 16 ms 324 KB
1
sample.txt AC 17 ms 384 KB
1