結果
問題 |
No.39 桁の数字を入れ替え
|
ユーザー |
![]() |
提出日時 | 2025-02-11 02:04:23 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 316 bytes |
コンパイル時間 | 4,773 ms |
コンパイル使用メモリ | 67,660 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-02-11 02:04:29 |
合計ジャッジ時間 | 5,542 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
import sequtils, strutils let s1 = stdin.readLine ns = s1.toSeq.mapIt ($it).parseInt var l, r: int s2 = s1 for i in 0 ..< s1.high: let max = (ns[i..^1]).max if max == ns[i]: continue l = i r = i.succ for j in i.succ .. s1.high: if ns[j] >= ns[r]: r = j swap(s2[l], s2[r]) break echo s2