結果
| 問題 |
No.723 2つの数の和
|
| コンテスト | |
| ユーザー |
neko_the_shadow
|
| 提出日時 | 2018-08-03 22:58:15 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 160 ms / 2,000 ms |
| コード長 | 212 bytes |
| コンパイル時間 | 35 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 24,960 KB |
| 最終ジャッジ日時 | 2024-09-19 17:37:12 |
| 合計ジャッジ時間 | 3,913 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n Syntax OK
ソースコード
n, x = gets.split.map(&:to_i)
digits = gets.split.map(&:to_i)
table = Hash.new(0)
digits.each{|digit| table[digit] += 1}
cnt = 0
table.keys.each do |digit|
cnt += table[digit] * table[x - digit]
end
puts cnt
neko_the_shadow