結果

問題 No.432 占い(Easy)
ユーザー tak
提出日時 2019-06-29 05:48:52
言語 F#
(F# 4.0)
結果
RE  
実行時間 -
コード長 815 bytes
コンパイル時間 13,944 ms
コンパイル使用メモリ 186,844 KB
実行使用メモリ 37,888 KB
最終ジャッジ日時 2024-07-02 05:22:45
合計ジャッジ時間 20,125 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 5 WA * 6 RE * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (575 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 #

module Yuki

open System


let solve ss =
    let num2Lis n =
        let rec f acc x =
            if x >= 10L then 
                f ((x % 10L) :: acc ) (x / 10L)
            else
                x :: acc
        f [] n

    let horoscope n =
        let rec f =
            function
            | [] -> failwith ""
            | x :: [] -> x
            | xs ->
                let ns =
                    xs
                    |> List.pairwise
                    |> List.map ((fun (a, b) -> a + b) >> num2Lis >> List.sum)
                f ns                        
        let ns = num2Lis n
        f ns    

    let ns = ss |> List.map int64
    ns |> List.map horoscope    
    
let T = Console.ReadLine() |> int
let S = List.init T (fun _ -> Console.ReadLine())

solve S
|> List.iter Console.WriteLine
0