結果

問題 No.39 桁の数字を入れ替え
ユーザー toshiro_yanagi
提出日時 2018-06-19 21:46:26
言語 Nim
(2.2.0)
結果
WA  
実行時間 -
コード長 277 bytes
コンパイル時間 3,599 ms
コンパイル使用メモリ 66,404 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 17:18:14
合計ジャッジ時間 4,135 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils, algorithm

var
  N = stdin.readLine
  arr_N = N.reversed.reversed
  dic = newSeq[int]()

for n in N:
  dic.add (n & "").parseInt

let
  p1 = N.rfind dic.max.repr
  p2 = N.find dic.min.repr

swap(arr_N[p1], arr_N[p2])

echo max(arr_N.join.parseInt, N.parseInt)
0