結果

問題 No.927 Second Permutation
ユーザー natoriusannatoriusan
提出日時 2023-08-01 21:38:40
言語 F#
(F# 4.0)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 7,105 ms
コンパイル使用メモリ 185,620 KB
実行使用メモリ 36,736 KB
最終ジャッジ日時 2024-04-19 20:41:39
合計ジャッジ時間 12,437 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
30,848 KB
testcase_01 AC 80 ms
31,360 KB
testcase_02 AC 78 ms
30,848 KB
testcase_03 AC 78 ms
30,976 KB
testcase_04 AC 74 ms
31,064 KB
testcase_05 AC 70 ms
30,976 KB
testcase_06 AC 79 ms
30,848 KB
testcase_07 AC 81 ms
31,232 KB
testcase_08 AC 113 ms
33,408 KB
testcase_09 AC 83 ms
30,976 KB
testcase_10 AC 126 ms
34,176 KB
testcase_11 AC 158 ms
36,352 KB
testcase_12 AC 118 ms
33,920 KB
testcase_13 AC 90 ms
31,872 KB
testcase_14 AC 131 ms
34,560 KB
testcase_15 AC 127 ms
33,792 KB
testcase_16 AC 156 ms
36,728 KB
testcase_17 AC 158 ms
36,736 KB
testcase_18 AC 164 ms
36,608 KB
testcase_19 AC 157 ms
36,608 KB
testcase_20 AC 162 ms
36,608 KB
testcase_21 AC 163 ms
36,608 KB
testcase_22 AC 160 ms
36,608 KB
testcase_23 AC 157 ms
36,736 KB
testcase_24 AC 149 ms
35,968 KB
testcase_25 AC 124 ms
34,688 KB
testcase_26 AC 119 ms
33,792 KB
testcase_27 AC 120 ms
33,368 KB
testcase_28 AC 156 ms
35,968 KB
testcase_29 AC 142 ms
35,200 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (255 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/

ソースコード

diff #

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"
0