結果

問題 No.723 2つの数の和
ユーザー smz_8110smz_8110
提出日時 2018-08-14 14:28:46
言語 Ruby
(3.3.0)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 175 bytes
コンパイル時間 772 ms
コンパイル使用メモリ 11,928 KB
実行使用メモリ 28,200 KB
最終ジャッジ日時 2023-10-24 17:06:24
合計ジャッジ時間 4,993 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
16,096 KB
testcase_01 AC 78 ms
16,096 KB
testcase_02 AC 78 ms
16,096 KB
testcase_03 AC 128 ms
23,296 KB
testcase_04 AC 152 ms
25,452 KB
testcase_05 AC 143 ms
24,388 KB
testcase_06 AC 142 ms
24,680 KB
testcase_07 AC 114 ms
20,256 KB
testcase_08 AC 114 ms
21,088 KB
testcase_09 AC 152 ms
25,576 KB
testcase_10 AC 110 ms
19,828 KB
testcase_11 AC 87 ms
16,656 KB
testcase_12 AC 118 ms
21,612 KB
testcase_13 AC 156 ms
25,796 KB
testcase_14 AC 99 ms
18,496 KB
testcase_15 AC 116 ms
20,888 KB
testcase_16 AC 128 ms
22,536 KB
testcase_17 AC 138 ms
24,260 KB
testcase_18 AC 125 ms
22,180 KB
testcase_19 AC 129 ms
22,664 KB
testcase_20 AC 76 ms
16,096 KB
testcase_21 AC 77 ms
16,096 KB
testcase_22 AC 75 ms
16,096 KB
testcase_23 AC 160 ms
28,200 KB
testcase_24 AC 101 ms
18,832 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N,X=gets.split.map &:to_i
h={}
gets.split.map(&:to_i).each{|n|h[n]=(h[n]||0)+1}
c=0
h.keys.sort.each{|n|
  break if n>X/2
  if h[m=X-n]
    c+=h[n]*h[m]*(2-1[n-m])
  end
}
p c
0