結果

問題 No.118 門松列(2)
ユーザー wotsushiwotsushi
提出日時 2017-04-10 18:52:11
言語 Ruby
(3.3.0)
結果
AC  
実行時間 170 ms / 5,000 ms
コード長 190 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 11,324 KB
実行使用メモリ 25,096 KB
最終ジャッジ日時 2023-09-25 06:49:45
合計ジャッジ時間 5,595 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,156 KB
testcase_01 AC 167 ms
25,096 KB
testcase_02 AC 167 ms
25,072 KB
testcase_03 AC 168 ms
25,000 KB
testcase_04 AC 167 ms
25,088 KB
testcase_05 AC 170 ms
25,088 KB
testcase_06 AC 81 ms
15,232 KB
testcase_07 AC 78 ms
15,284 KB
testcase_08 AC 79 ms
15,200 KB
testcase_09 AC 162 ms
22,808 KB
testcase_10 AC 118 ms
17,128 KB
testcase_11 AC 126 ms
18,960 KB
testcase_12 AC 117 ms
17,272 KB
testcase_13 AC 116 ms
16,868 KB
testcase_14 AC 163 ms
22,764 KB
testcase_15 AC 113 ms
16,520 KB
testcase_16 AC 141 ms
20,908 KB
testcase_17 AC 115 ms
16,852 KB
testcase_18 AC 128 ms
19,076 KB
testcase_19 AC 137 ms
20,396 KB
testcase_20 AC 141 ms
20,724 KB
testcase_21 AC 157 ms
21,156 KB
testcase_22 AC 121 ms
17,108 KB
testcase_23 AC 149 ms
20,416 KB
testcase_24 AC 129 ms
18,996 KB
testcase_25 AC 134 ms
20,052 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
A = gets.split.map(&:to_i)
C = A.inject(Hash.new(0)) {|hash, a| hash[a] += 1; hash}
ans = (C.values.combination(3).map {|x, y, z| x * y * z}.inject(:+)) % (10**9 + 7)
puts ans
0