結果
問題 |
No.39 桁の数字を入れ替え
|
ユーザー |
![]() |
提出日時 | 2015-03-31 22:48:23 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 329 bytes |
コンパイル時間 | 3,597 ms |
コンパイル使用メモリ | 64,896 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 01:37:20 |
合計ジャッジ時間 | 4,152 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 39) Warning: imported and not used: 'math' [UnusedImport] /home/judge/data/code/Main.nim(1, 18) Warning: imported and not used: 'sequtils' [UnusedImport] /home/judge/data/code/Main.nim(1, 28) Warning: imported and not used: 'algorithm' [UnusedImport]
ソースコード
import strutils, sequtils, algorithm, math var n = readLine(stdin).parseInt() nStr = n.intToStr() nStrTmp: string maxV = n for i in countup(0, nStr.len() - 2): for j in countup(1, nStr.len() - 1): nStrTmp = nStr nStrTmp[i] = nStr[j] nStrTmp[j] = nStr[i] maxV = max(maxV, nStrTmp.parseInt) echo(maxV)