結果
| 問題 | 
                            No.432 占い(Easy)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tak
                         | 
                    
| 提出日時 | 2019-06-29 06:00:40 | 
| 言語 | F#  (F# 4.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 180 ms / 2,000 ms | 
| コード長 | 931 bytes | 
| コンパイル時間 | 7,182 ms | 
| コンパイル使用メモリ | 188,188 KB | 
| 実行使用メモリ | 53,248 KB | 
| 最終ジャッジ日時 | 2024-07-02 05:23:17 | 
| 合計ジャッジ時間 | 10,112 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 22 | 
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (241 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/
ソースコード
module Yuki
open System
let solve ss =
    let inline str2Lis (str : string) =
        str.ToCharArray()
        |> Array.map (string >> int)
        |> Array.toList
    let inline num2Lis n =        
        let rec f acc x =
            if x >= 10 then 
                f ((x % 10) :: acc ) (x / 10)
            else
                x :: acc
        f [] n
    let horoscope (str : string) =
        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 = str2Lis str
        f ns    
    ss
    |> List.map horoscope
let T = Console.ReadLine() |> int
let S = List.init T (fun _ -> Console.ReadLine())
solve S
|> List.iter Console.WriteLine
            
            
            
        
            
tak