結果

問題 No.256 桁の数字を入れ替え (2)
ユーザー osrgy01osrgy01
提出日時 2021-02-21 13:27:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 304 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 11,912 KB
実行使用メモリ 11,476 KB
最終ジャッジ日時 2023-10-19 15:55:36
合計ジャッジ時間 841 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
9,996 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n=input()
zero=False
if n[-1]=='0':
    zero=True
n=[*n[::-1]]
ans=[];cnt=0
for i in '99887766554433221100':
    if i in n:
        del n[n.index(i)]
        ans.append(i)
        cnt+=1
    if cnt==2:
        break
n=''.join(n[::-1])
ans=''.join(ans)
if zero:
    print(ans+n+'0')
else:
    print(ans+n)
0