結果

問題 No.170 スワップ文字列(Easy)
ユーザー yosupot
提出日時 2015-03-22 23:34:11
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 10 ms / 5,000 ms
コード長 804 bytes
コンパイル時間 603 ms
コンパイル使用メモリ 67,868 KB
実行使用メモリ 17,792 KB
最終ジャッジ日時 2024-12-23 00:15:03
合計ジャッジ時間 1,608 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <cassert>
#include <cstdio>
 
using namespace std;

typedef long long ll;

int comb[1919][1919];
void init() {
    comb[0][0] = 1;
    for (int i = 1; i < 1919; i++) {
        comb[i][0] = 1;
        for (int j = 1; j < 1919; j++) {
            comb[i][j] = (comb[i-1][j] + comb[i-1][j-1]);// % 573;
        }
    }
}
int d[26];
int main() {
    init();
    string s;
    cin >> s;
    int n = (int)s.size();
    for (char c: s) {
        d[c-'A']++;
    }
    ll res = 1;
    for (int i = 0; i < 26; i++) {
        res *= comb[n][d[i]];
        n -= d[i];
//        res %= 573;
    }
    cout << res - 1 << endl;
//    cout << (res + 572) % 573 << endl;
    return 0;
}
0