結果

問題 No.1904 Never giving up!
ユーザー lam6er
提出日時 2025-03-20 20:27:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 81,984 KB
実行使用メモリ 59,388 KB
最終ジャッジ日時 2025-03-20 20:28:57
合計ジャッジ時間 1,322 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

n = int(input())
A = list(map(int, input().split()))
A.sort()

group_counts = []
current = A[0]
count = 1

for num in A[1:]:
    if num == current:
        count += 1
    else:
        group_counts.append(count)
        current = num
        count = 1
group_counts.append(count)  # Add the last group

product = 1
for c in group_counts:
    product *= math.factorial(c)

n_fact = math.factorial(n)
ans = n_fact // product

print(ans)
0