結果
| 問題 |
No.432 占い(Easy)
|
| コンテスト | |
| ユーザー |
tak
|
| 提出日時 | 2019-06-29 05:59:30 |
| 言語 | F# (F# 4.0) |
| 結果 |
AC
|
| 実行時間 | 176 ms / 2,000 ms |
| コード長 | 917 bytes |
| コンパイル時間 | 14,047 ms |
| コンパイル使用メモリ | 187,880 KB |
| 実行使用メモリ | 53,632 KB |
| 最終ジャッジ日時 | 2024-07-02 05:23:03 |
| 合計ジャッジ時間 | 17,188 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (403 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 str2Lis (str : string) =
str.ToCharArray()
|> Array.map (string >> int)
|> Array.toList
let 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