結果

問題 No.171 スワップ文字列(Med)
ユーザー motimoti
提出日時 2015-04-09 10:24:49
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 631 bytes
コンパイル時間 1,892 ms
コンパイル使用メモリ 144,940 KB
実行使用メモリ 10,868 KB
最終ジャッジ日時 2023-09-17 18:58:16
合計ジャッジ時間 2,531 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
10,488 KB
testcase_01 WA -
testcase_02 AC 5 ms
10,620 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 6 ms
10,556 KB
testcase_11 AC 5 ms
10,460 KB
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;

int const MOD = 573;

ll comb[1010][1010];
void make_comb(int n) {
	rep(i, n+1) {
        comb[i][0] = 1;
        REP(j, 1, i+1) {
            comb[i][j] = comb[i-1][j-1] + comb[i-1][j];
            comb[i][j] %= MOD;
        }
    }
}

int main() {
	make_comb(1005);
	string s; cin >> s;
	int sz = s.size();
	int mp[26]={};
	rep(i, sz) { mp[s[i]-'A']++; }
	ll ans = 1;
	rep(i, 26) {
		if(mp[i]) {
			ans *= comb[sz][mp[i]];
			sz -= mp[i];
		}
	}

	cout << ans-1 << endl;

	return 0;
}
0