結果

問題 No.723 2つの数の和
ユーザー taktak
提出日時 2019-02-22 20:02:51
言語 F#
(.NET 7)
結果
WA  
実行時間 -
コード長 424 bytes
コンパイル時間 5,367 ms
コンパイル使用メモリ 167,852 KB
実行使用メモリ 45,904 KB
最終ジャッジ日時 2023-08-16 11:53:44
合計ジャッジ時間 11,065 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
22,396 KB
testcase_01 AC 74 ms
22,624 KB
testcase_02 AC 72 ms
22,504 KB
testcase_03 AC 212 ms
41,936 KB
testcase_04 AC 252 ms
45,760 KB
testcase_05 AC 244 ms
43,848 KB
testcase_06 AC 252 ms
43,244 KB
testcase_07 AC 161 ms
34,864 KB
testcase_08 AC 174 ms
35,792 KB
testcase_09 AC 264 ms
45,904 KB
testcase_10 AC 158 ms
36,540 KB
testcase_11 AC 98 ms
27,716 KB
testcase_12 AC 178 ms
36,196 KB
testcase_13 AC 259 ms
43,948 KB
testcase_14 AC 131 ms
31,840 KB
testcase_15 AC 163 ms
37,260 KB
testcase_16 AC 201 ms
37,932 KB
testcase_17 AC 231 ms
43,616 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 73 ms
24,360 KB
testcase_21 AC 74 ms
24,472 KB
testcase_22 AC 72 ms
24,464 KB
testcase_23 AC 289 ms
42,312 KB
testcase_24 AC 140 ms
32,336 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

open System

let solve a x =
  let countMap = 
    a |> Array.countBy id
    |> Map.ofArray
  let countMapSeq = countMap |> Map.toSeq

  countMapSeq |> Seq.map(fun (k, v) ->
    let k' = x - k
    countMap.TryFind k' |> function
    | None -> 0
    | Some c -> v * c)
  |> Seq.sum  

let R() = Console.ReadLine().Split() |> Array.map int

let N, X = 
  let t = R()
  t.[0], t.[1]

let a = R()

solve a X
|> Console.WriteLine
0