Submission #78860
ソースコード
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 | #include<stdio.h> int main(){ int n; scanf ( "%d" ,&n); int a[n]; for ( int i=0;i<n;i++){ scanf ( "%d" ,&a[i]); } int max; int keep; for ( int i=0;i<n;i++){ max = i; for ( int j=i+1;j<n;j++){ if (a[max]<a[j]){ max = j; } } keep = a[i]; a[i] = a[max]; a[max] = keep; } for ( int i=0;i<n;i++){ printf ( "%d\n" ,a[i]); } return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0930 - 背の順 |
ユーザー名 | ei2408 |
投稿日時 | 2024-05-21 16:38:29 |
言語 | C |
状態 | Accepted |
得点 | 1 |
ソースコード長 | 489 Byte |
最大実行時間 | 45 ms |
最大メモリ使用量 | 504 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 1 / 1 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
rnd_1.txt | AC | 22 ms | 504 KB |
1
|
rnd_2.txt | AC | 45 ms | 308 KB |
1
|
rnd_3.txt | AC | 21 ms | 316 KB |
1
|
rnd_4.txt | AC | 23 ms | 368 KB |
1
|
rnd_5.txt | AC | 20 ms | 416 KB |
1
|
sample.txt | AC | 23 ms | 472 KB |
1
|