結果

問題 No.39 桁の数字を入れ替え
ユーザー tnoda_tnoda_
提出日時 2015-08-01 17:17:02
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 288 bytes
コンパイル時間 401 ms
コンパイル使用メモリ 6,684 KB
実行使用メモリ 6,100 KB
最終ジャッジ日時 2023-09-25 00:19:01
合計ジャッジ時間 1,992 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,092 KB
testcase_01 AC 11 ms
5,940 KB
testcase_02 AC 11 ms
5,880 KB
testcase_03 AC 11 ms
6,028 KB
testcase_04 AC 11 ms
6,080 KB
testcase_05 AC 11 ms
6,092 KB
testcase_06 WA -
testcase_07 AC 11 ms
6,004 KB
testcase_08 AC 12 ms
6,028 KB
testcase_09 AC 11 ms
6,008 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 11 ms
5,948 KB
testcase_15 AC 11 ms
5,856 KB
testcase_16 AC 11 ms
5,872 KB
testcase_17 AC 11 ms
6,064 KB
testcase_18 AC 11 ms
6,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = raw_input()
ds = [int(x) for x in S]
dmax = max(ds)
dmin = min(ds)
argmax = len(ds) - 1
while ds[argmax] != dmax:
    argmax -= 1
argmin = 0
while ds[argmin] != dmin:
    argmin += 1
if argmin < argmax:
    ds[argmin] = dmax
    ds[argmax] = dmin
print(''.join([str(x) for x in ds]))
0