結果

問題 No.723 2つの数の和
ユーザー koi_kotyakoi_kotya
提出日時 2018-08-03 23:06:55
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 184 bytes
コンパイル時間 50 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 29,600 KB
最終ジャッジ日時 2024-09-19 17:38:26
合計ジャッジ時間 5,352 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
19,104 KB
testcase_01 AC 81 ms
12,160 KB
testcase_02 AC 80 ms
12,160 KB
testcase_03 AC 135 ms
19,968 KB
testcase_04 AC 173 ms
22,400 KB
testcase_05 AC 168 ms
20,864 KB
testcase_06 AC 146 ms
21,888 KB
testcase_07 AC 108 ms
16,000 KB
testcase_08 AC 119 ms
17,536 KB
testcase_09 AC 142 ms
22,400 KB
testcase_10 AC 125 ms
15,872 KB
testcase_11 AC 94 ms
12,800 KB
testcase_12 AC 115 ms
18,432 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,x = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
c = Hash.new(0)
ans = 0
for i in 0..n-1
  c[a[i]] += 1
end
for i in 0..x
  ans += c[i]*c[x-i]
end
puts ans
0