結果
問題 |
No.39 桁の数字を入れ替え
|
ユーザー |
![]() |
提出日時 | 2019-09-23 01:16:38 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 471 bytes |
コンパイル時間 | 249 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 88,832 KB |
最終ジャッジ日時 | 2024-09-19 03:50:43 |
合計ジャッジ時間 | 3,787 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 19 |
ソースコード
from fractions import gcd from heapq import* import math from collections import defaultdict, Counter import sys sys.setrecursionlimit(10 ** 7) MOD = 10 ** 9 + 7 def main(): n = int(input()) sn = list(str(n)) base = int(sn[0]) change = -1 for i in range(1, len(sn)): if int(sn[i]) > base: change = i sn[0], sn[change] = sn[change], sn[0] print(max(n, int("".join(map(str, sn))))) if __name__ == '__main__': main()