Submission #35817


ソースコード

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
#include <cstdio>
#include <algorithm>
#define rep(i,n) for(int i=0; i<(n); ++i)
using std::swap;
// bubble-sort バブルソート
// 普通すぎてつまらない: O(N^2)
void sort(int a[], int n)
{
for (int i=0; i<n-1; ++i)
for (int j=0; j<n-i-1; ++j)
if (a[j] < a[j+1])
swap(a[j], a[j+1]);
return;
}
int main()
{
int n;
int a[102];
scanf("%d", &n);
rep(i, n)
scanf("%d", a+i);
sort(a, n);
rep(i, n)
printf("%d\n", a[i]);
return (0);
}

ステータス

項目 データ
問題 0930 - 背の順
ユーザー名 Arumakan_ei1727
投稿日時 2018-05-16 18:51:09
言語 C++11
状態 Accepted
得点 1
ソースコード長 544 Byte
最大実行時間 28 ms
最大メモリ使用量 672 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
rnd_1.txt AC 27 ms 480 KB
1
rnd_2.txt AC 23 ms 464 KB
1
rnd_3.txt AC 17 ms 448 KB
1
rnd_4.txt AC 17 ms 560 KB
1
rnd_5.txt AC 28 ms 672 KB
1
sample.txt AC 23 ms 656 KB
1