Submission #00114


ソースコード

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
#include <stdio.h>
int main() {
int n, c;
scanf("%d", &n);
char s[n];
int a[n];
scanf("%s", &s);
for (int i = 0; i < n; i++) {
if (s[i] == 'J') {
a[i] = 3;
} else if (s[i] == 'O') {
a[i] = 2;
} else {
a[i] = 1;
}
}
for (int j = 0; j < n; j++) {
for (int i = 0; i < n - 1; i++) {
if (a[i] < a[i + 1]) {
c = a[i];
a[i] = a[i + 1];
a[i + 1] = c;
}
}
}
for (int i = 0; i < n; i++) {
if (a[i] == 3) {
s[i] = 'J';
} else if (a[i] == 2) {
s[i] = 'O';
} else {
s[i] = 'I';
}
}
printf("%s\n", s);
return(0);
}

ステータス

項目 データ
問題 0005 - JOI ソート
ユーザー名 woody_1227
投稿日時 2022-05-23 18:11:00
言語 C
状態 Accepted
得点 2
ソースコード長 786 Byte
最大実行時間 27 ms
最大メモリ使用量 592 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
01-01.txt AC 24 ms 376 KB
1
01-02.txt AC 21 ms 396 KB
1
01-03.txt AC 18 ms 352 KB
1
01-04.txt AC 19 ms 504 KB
1
01-05.txt AC 18 ms 552 KB
1
01-06.txt AC 19 ms 388 KB
1
01-07.txt AC 19 ms 400 KB
1
01-08.txt AC 21 ms 456 KB
1
01-09.txt AC 24 ms 508 KB
1
01-10.txt AC 20 ms 464 KB
1
01-11.txt AC 19 ms 476 KB
1
01-12.txt AC 27 ms 532 KB
1
01-13.txt AC 22 ms 484 KB
1
01-14.txt AC 25 ms 416 KB
1
01-15.txt AC 24 ms 440 KB
1
01-16.txt AC 20 ms 492 KB
1
sample-01.txt AC 17 ms 540 KB
1
sample-02.txt AC 18 ms 592 KB
1
sample-03.txt AC 23 ms 548 KB
1