結果

問題 No.791 うし数列
ユーザー tak
提出日時 2019-02-22 21:27:58
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 329 bytes
コンパイル時間 9,805 ms
コンパイル使用メモリ 188,708 KB
実行使用メモリ 31,360 KB
最終ジャッジ日時 2024-11-25 05:19:45
合計ジャッジ時間 11,514 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (743 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 #

open System

let solve (n: string) =
  let f = n.Substring(0, 1)
  let e = n.Substring(1)
  let ea = e.ToCharArray()
  let el = ea |> Array.length
  let edl = ea |> Array.distinct |> Array.length

  if f = "1" && edl = 1 then el
  elif f = "1" && edl = 0 then 1
  else -1

let N = Console.ReadLine()

solve N
|> Console.WriteLine
0