結果

問題 No.118 門松列(2)
ユーザー 👑 horiesinitihoriesiniti
提出日時 2018-03-16 19:52:23
言語 Ruby
(3.3.0)
結果
AC  
実行時間 156 ms / 5,000 ms
コード長 253 bytes
コンパイル時間 57 ms
コンパイル使用メモリ 11,236 KB
実行使用メモリ 21,456 KB
最終ジャッジ日時 2023-08-23 11:55:44
合計ジャッジ時間 4,891 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
15,112 KB
testcase_01 AC 155 ms
21,360 KB
testcase_02 AC 150 ms
21,276 KB
testcase_03 AC 154 ms
21,160 KB
testcase_04 AC 153 ms
21,288 KB
testcase_05 AC 156 ms
21,456 KB
testcase_06 AC 82 ms
15,148 KB
testcase_07 AC 81 ms
15,240 KB
testcase_08 AC 81 ms
15,076 KB
testcase_09 AC 148 ms
20,468 KB
testcase_10 AC 104 ms
16,184 KB
testcase_11 AC 112 ms
16,664 KB
testcase_12 AC 103 ms
16,088 KB
testcase_13 AC 102 ms
15,284 KB
testcase_14 AC 143 ms
20,456 KB
testcase_15 AC 101 ms
15,140 KB
testcase_16 AC 126 ms
18,352 KB
testcase_17 AC 102 ms
15,376 KB
testcase_18 AC 114 ms
16,692 KB
testcase_19 AC 121 ms
17,900 KB
testcase_20 AC 123 ms
18,076 KB
testcase_21 AC 132 ms
19,892 KB
testcase_22 AC 105 ms
16,272 KB
testcase_23 AC 129 ms
19,564 KB
testcase_24 AC 114 ms
16,884 KB
testcase_25 AC 117 ms
17,572 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

hs=Hash.new(0)
gets
x=gets.split.map{|e| e.to_i}
x.each{|e|
	hs[e]+=1
}
if hs.size<3
	puts 0
else
	y=hs.values
	ans=0
	m=y.size
	m.times{|i|
		((i+1)..(m-1)).each{|j|
			((j+1)..(m-1)).each{|k|
				ans+=y[i]*y[j]*y[k]
			}
		}
	}
	puts ans%(10**9+7)
end
0