結果

問題 No.118 門松列(2)
ユーザー pekempey
提出日時 2015-12-20 23:47:44
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 237 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 12,188 KB
最終ジャッジ日時 2024-09-17 12:25:59
合計ジャッジ時間 2,083 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

n = input()
a = map(int, raw_input().split())
a.sort()

num = [0] * 101
for x in a:
	num[x] += 1

s1, s2, s3 = 0, 0, 0
for x in num:
	s1 += x
	s2 += x * x
	s3 += x * x * x

ans = (s1 ** 3 - s1 * s2 - 2 * s1 * s2 + 2 * s3) / 6

print ans
0