結果
| 問題 | No.3178 free sort |
| コンテスト | |
| ユーザー |
回転
|
| 提出日時 | 2025-06-24 05:09:18 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 421 bytes |
| 記録 | |
| コンパイル時間 | 238 ms |
| コンパイル使用メモリ | 95,852 KB |
| 実行使用メモリ | 101,504 KB |
| 最終ジャッジ日時 | 2026-07-12 19:09:19 |
| 合計ジャッジ時間 | 9,841 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | RE * 40 |
ソースコード
from collections import Counter
MOD = 998244353
N = input()
d = Counter(list(map(int,list(N))))
fact = [1]
for i in range(10**5):
fact.append(fact[-1] * (i+1) % MOD)
ans = fact[len(N)]
for i in d:
ans *= pow(fact[d[i]],-1,MOD)
ans %= MOD
if(d[0] > 0):
tmp = fact[len(N)-1]
d[0] -= 1
for i in d:
tmp *= pow(fact[d[i]],-1,MOD)
tmp %= MOD
ans -= tmp
ans %= MOD
print(ans)
回転