結果

問題 No.791 うし数列
ユーザー chike_plus
提出日時 2019-03-28 19:23:41
言語 F#
(F# 4.0)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 560 bytes
コンパイル時間 14,772 ms
コンパイル使用メモリ 186,628 KB
実行使用メモリ 33,152 KB
最終ジャッジ日時 2024-10-13 10:07:02
合計ジャッジ時間 16,735 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (396 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