結果
| 問題 |
No.662 スロットマシーン
|
| コンテスト | |
| ユーザー |
tak
|
| 提出日時 | 2018-03-16 14:19:24 |
| 言語 | F# (F# 4.0) |
| 結果 |
AC
|
| 実行時間 | 360 ms / 2,000 ms |
| コード長 | 1,132 bytes |
| コンパイル時間 | 6,139 ms |
| コンパイル使用メモリ | 187,212 KB |
| 実行使用メモリ | 36,800 KB |
| 最終ジャッジ日時 | 2024-12-21 14:27:29 |
| 合計ジャッジ時間 | 13,602 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (207 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/
ソースコード
open System
open System.Collections.Generic
let read() = Console.ReadLine()
let readInt() = read() |> int
let make() =
let num = readInt()
let arr = Array.init num (fun _ -> read())
int64 num,arr
let cnt keys arr =
let t = new Dictionary<string,int64>()
for k in keys do
t.[k] <- 0L
for v in arr do
t.[v] <- t.[v] + 1L
t
let scores =
let t = new Dictionary<string,int64>()
for i in 1..5 do
let tt = Console.ReadLine().Split()
t.[tt.[0]] <- tt.[1] |> int64
t
let n1,A = make()
let n2,B = make()
let n3,C = make()
let cnt0 = cnt scores.Keys
let cntA = cnt0 A
let cntB = cnt0 B
let cntC = cnt0 C
let occurrences =
let t = new Dictionary<string,int64>()
for k in scores.Keys do
t.[k] <- 0L
t
let mutable sum = 0L
for k in scores.Keys do
let occur = cntA.[k] * cntB.[k] * cntC.[k] * 5L
if occur <> 0L then
sum <- sum + occur * scores.[k]
occurrences.[k] <- occurrences.[k] + occur
float sum / float (n1 * n2 * n3)
|> printfn "%f"
scores.Keys
|> seq
|> Seq.iter(fun k -> printfn "%i" occurrences.[k])
tak