結果
| 問題 | No.170 スワップ文字列(Easy) | 
| コンテスト | |
| ユーザー |  kyuna | 
| 提出日時 | 2019-08-19 19:18:17 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 395 bytes | 
| コンパイル時間 | 726 ms | 
| コンパイル使用メモリ | 71,552 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-04 20:59:56 | 
| 合計ジャッジ時間 | 1,325 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 | 
ソースコード
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
    vector<int> cnt(26);
    string s; cin >> s;
    for (char c: s) cnt[c - 'A']++;
    vector<int> fact(9, 1);
    for (int i = 2; i <= 8; i++) fact[i] = fact[i - 1] * i;
    int ans = fact[s.size()];
    for (int i = 0; i < 26; i++) ans /= fact[cnt[i]];
    cout << ans - 1 << endl;
    return 0;
}
            
            
            
        