結果

問題 No.791 うし数列
コンテスト
ユーザー chike_plus
提出日時 2019-03-28 19:23:41
言語 F#
(F# 10.0)
コンパイル:
fsharp_c _filename_
実行:
/usr/bin/dotnet_wrap
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 560 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 9,309 ms
コンパイル使用メモリ 214,520 KB
実行使用メモリ 35,456 KB
最終ジャッジ日時 2026-04-30 19:19:53
合計ジャッジ時間 13,132 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (200 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net10.0/main.dll
  main -> /home/judge/data/code/bin/Release/net10.0/publish/

ソースコード

diff #
raw source code

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