結果

問題 No.170 スワップ文字列(Easy)
ユーザー fumi6328
提出日時 2018-10-08 21:08:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 463 bytes
コンパイル時間 1,406 ms
コンパイル使用メモリ 169,996 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-12 15:46:25
合計ジャッジ時間 2,255 ms
ジャッジサーバーID
(参考情報)
judge / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int kai(int n)
{
    if(n == 1) return 1;
    return n * kai(n-1);
}

int main()
{
    string s;
    cin >> s;
    vector<int> cnt(26,0);
    for(int i = 0; i < s.length(); i++) cnt[s[i]-'A']++;

    int a,b = 1;
    a = kai(s.length());
    for(int i = 0; i < 26; i++){
        if(cnt[i] == 0) continue;
        b *= kai(cnt[i]);
    }
     
    cout << a / b - 1 << endl;

    return 0;
}
0