結果
問題 |
No.170 スワップ文字列(Easy)
|
ユーザー |
|
提出日時 | 2020-04-22 18:28:35 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 316 bytes |
コンパイル時間 | 2,650 ms |
コンパイル使用メモリ | 191,804 KB |
最終ジャッジ日時 | 2025-01-09 22:36:24 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; int main(){ string s; cin>>s; int hist[128]={}; for(char c:s) hist[c]++; int fact[9]={1}; rep(i,8) fact[i+1]=(i+1)*fact[i]; int ans=fact[s.length()]; rep(c,128) ans/=fact[hist[c]]; printf("%d\n",ans-1); return 0; }