結果

問題 No.170 スワップ文字列(Easy)
ユーザー yosupotyosupot
提出日時 2015-03-22 23:34:11
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 8 ms / 5,000 ms
コード長 804 bytes
コンパイル時間 684 ms
コンパイル使用メモリ 68,520 KB
実行使用メモリ 17,940 KB
最終ジャッジ日時 2023-08-24 16:05:16
合計ジャッジ時間 1,895 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
17,668 KB
testcase_01 AC 7 ms
17,728 KB
testcase_02 AC 7 ms
17,668 KB
testcase_03 AC 7 ms
17,716 KB
testcase_04 AC 7 ms
17,716 KB
testcase_05 AC 7 ms
17,720 KB
testcase_06 AC 7 ms
17,648 KB
testcase_07 AC 8 ms
17,840 KB
testcase_08 AC 7 ms
17,784 KB
testcase_09 AC 7 ms
17,724 KB
testcase_10 AC 7 ms
17,660 KB
testcase_11 AC 7 ms
17,932 KB
testcase_12 AC 8 ms
17,664 KB
testcase_13 AC 7 ms
17,716 KB
testcase_14 AC 8 ms
17,716 KB
testcase_15 AC 7 ms
17,728 KB
testcase_16 AC 7 ms
17,852 KB
testcase_17 AC 7 ms
17,668 KB
testcase_18 AC 7 ms
17,940 KB
testcase_19 AC 7 ms
17,784 KB
testcase_20 AC 7 ms
17,664 KB
testcase_21 AC 7 ms
17,720 KB
testcase_22 AC 7 ms
17,724 KB
testcase_23 AC 7 ms
17,716 KB
権限があれば一括ダウンロードができます

ソースコード

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