結果

問題 No.791 うし数列
ユーザー chike_pluschike_plus
提出日時 2019-03-28 19:23:41
言語 F#
(F# 4.0)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 560 bytes
コンパイル時間 16,076 ms
コンパイル使用メモリ 186,872 KB
実行使用メモリ 33,024 KB
最終ジャッジ日時 2024-04-21 11:33:04
合計ジャッジ時間 15,671 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
31,616 KB
testcase_01 AC 53 ms
31,744 KB
testcase_02 AC 51 ms
31,744 KB
testcase_03 AC 51 ms
31,872 KB
testcase_04 AC 59 ms
31,720 KB
testcase_05 AC 49 ms
31,872 KB
testcase_06 AC 50 ms
32,000 KB
testcase_07 AC 51 ms
31,744 KB
testcase_08 AC 63 ms
31,744 KB
testcase_09 AC 51 ms
31,732 KB
testcase_10 AC 63 ms
33,024 KB
testcase_11 AC 63 ms
32,896 KB
testcase_12 AC 66 ms
31,744 KB
testcase_13 AC 63 ms
31,744 KB
testcase_14 AC 61 ms
31,488 KB
testcase_15 AC 62 ms
31,616 KB
testcase_16 AC 62 ms
31,584 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (413 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 ``No.791 うし数列``() =

  let s = stdin.ReadLine()
  if not (s.StartsWith("1") && s.EndsWith("3"))
    then -1
    else s
         |> Seq.countBy (fun c -> c)
         |> fun arg ->
          if (Seq.length arg > 2 || 
              arg 
              |> Seq.tryFind (fun (a,b) -> a = '1')  
              |> fun arg -> arg.IsSome && snd(arg.Value) > 1)
            then -1
            else arg 
                |> Seq.find (fun (k , v) -> '3' = k )
                |> fun t -> snd(t)
  |> stdout.WriteLine              
  ()
``No.791 うし数列``()
0