結果
問題 | No.927 Second Permutation |
ユーザー |
|
提出日時 | 2023-08-01 21:38:40 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 178 ms / 2,000 ms |
コード長 | 420 bytes |
コンパイル時間 | 15,442 ms |
コンパイル使用メモリ | 193,656 KB |
実行使用メモリ | 36,864 KB |
最終ジャッジ日時 | 2024-10-11 12:58:03 |
合計ジャッジ時間 | 12,178 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (309 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
let x = stdin.ReadLine () |> Seq.sortDescending |> Seq.map string |> String.concat "" if x.Length = 1 || Seq.forall ((=)x.[0]) x || Seq.filter ((=)'0') x |> Seq.length = x.Length - 1 then "-1" else let mutable index = x.Length - 2 while x.[index] = x.[index+1] do index <- index - 1 (if index = 0 then "" else x.[..index-1]) + string x.[index+1] + string x.[index] + x.[index+2..] |> printfn "%s"