結果
| 問題 |
No.39 桁の数字を入れ替え
|
| ユーザー |
masumasumath1
|
| 提出日時 | 2019-12-08 11:29:38 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 468 bytes |
| コンパイル時間 | 182 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-12-29 22:57:39 |
| 合計ジャッジ時間 | 1,825 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 8 |
ソースコード
N = int(input())
listN = list(str(N))
first = listN[0]
for i in range(1,len(listN)):
flg = True
second = listN[i]
if first < second:
flg = False
break
first = second
if flg:
print(N)
exit()
maxs = [i for i,x in enumerate(listN) if x == max(listN)]
id1 = maxs[0]
id2 = maxs[-1]
if len(maxs) > 1 and (id1 == id2 or id1 == 0):
print(N)
else:
listN[0],listN[id2] = listN[id2],listN[0]
print(int("".join(map(str,listN))))
masumasumath1