結果
| 問題 |
No.3178 free sort
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-15 02:13:52 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 2,000 ms |
| コード長 | 621 bytes |
| コンパイル時間 | 3,190 ms |
| コンパイル使用メモリ | 281,368 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-06-15 02:13:59 |
| 合計ジャッジ時間 | 7,373 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 40 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#include<atcoder/modint>
using namespace atcoder;
using mint=modint998244353;
void solve(){
string S;
cin>>S;
vector<int> C(10,0);
for(auto s:S)C[s-'0']++;
mint an=1,bn=1;
for(int i=0;i<S.size();i++){
an*=(i+1);
if(i==S.size()-1)break;
bn*=(i+1);
}
for(int i=0;i<10;i++){
for(int j=0;j<C[i];j++){
an/=mint(j+1);
if(i==0&&j==C[i]-1)break;
bn/=mint(j+1);
}
}
if(C[0]!=0){
an-=bn;
}
cout<<an.val()<<endl;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T=1;
// cin>>T;
while(T--)solve();
}