結果

問題 No.723 2つの数の和
ユーザー koi_kotyakoi_kotya
提出日時 2018-08-03 23:00:21
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 186 bytes
コンパイル時間 125 ms
コンパイル使用メモリ 11,916 KB
実行使用メモリ 25,240 KB
最終ジャッジ日時 2023-10-19 21:36:49
合計ジャッジ時間 5,649 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
16,108 KB
testcase_01 AC 87 ms
16,108 KB
testcase_02 AC 86 ms
16,108 KB
testcase_03 AC 142 ms
23,076 KB
testcase_04 AC 182 ms
25,104 KB
testcase_05 AC 175 ms
23,992 KB
testcase_06 AC 154 ms
24,300 KB
testcase_07 AC 120 ms
19,804 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 135 ms
19,624 KB
testcase_11 AC 101 ms
16,632 KB
testcase_12 AC 128 ms
21,816 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 1..x-1
  ans += c[i]*c[x-i]
end
puts ans
0