結果
問題 | No.39 桁の数字を入れ替え |
ユーザー |
|
提出日時 | 2021-12-12 01:04:09 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 383 bytes |
コンパイル時間 | 171 ms |
コンパイル使用メモリ | 81,932 KB |
実行使用メモリ | 53,720 KB |
最終ジャッジ日時 | 2024-07-20 09:00:52 |
合計ジャッジ時間 | 1,786 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
51,584 KB |
testcase_01 | AC | 40 ms
51,968 KB |
testcase_02 | AC | 41 ms
51,968 KB |
testcase_03 | AC | 39 ms
52,352 KB |
testcase_04 | AC | 38 ms
51,584 KB |
testcase_05 | AC | 37 ms
51,456 KB |
testcase_06 | AC | 38 ms
51,456 KB |
testcase_07 | AC | 39 ms
52,096 KB |
testcase_08 | AC | 39 ms
51,584 KB |
testcase_09 | AC | 38 ms
51,840 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 41 ms
51,712 KB |
testcase_15 | AC | 40 ms
51,712 KB |
testcase_16 | AC | 38 ms
51,968 KB |
testcase_17 | AC | 38 ms
51,840 KB |
testcase_18 | AC | 38 ms
51,840 KB |
ソースコード
N = list(map(int, list(input()))) for n in reversed(range(1, 10)): positions_n = [p for p,v in enumerate(N) if v == n] if len(positions_n) > 0: n_pos = max(positions_n) for j in range(n_pos): if N[j] < N[n_pos]: N[j],N[n_pos] = N[n_pos],N[j] break else: continue break print("".join(map(str, N)))