結果

問題 No.171 スワップ文字列(Med)
ユーザー tkzw_21tkzw_21
提出日時 2015-03-22 23:53:29
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 631 bytes
コンパイル時間 1,153 ms
コンパイル使用メモリ 146,016 KB
実行使用メモリ 10,416 KB
最終ジャッジ日時 2023-09-11 09:37:41
合計ジャッジ時間 2,032 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
10,284 KB
testcase_01 AC 11 ms
10,324 KB
testcase_02 AC 11 ms
10,296 KB
testcase_03 AC 11 ms
10,292 KB
testcase_04 AC 11 ms
10,288 KB
testcase_05 WA -
testcase_06 AC 11 ms
10,372 KB
testcase_07 AC 12 ms
10,416 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 11 ms
10,320 KB
testcase_11 AC 11 ms
10,236 KB
testcase_12 AC 11 ms
10,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

long long nCr[1010][1010];

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

	nCr[0][0] = 1;
	for(int i=0;i<=1000;i++) for(int j=0;j<i+1;j++) {
		nCr[i + 1][j] += nCr[i][j];
		nCr[i + 1][j + 1] += nCr[i][j];
		nCr[i+1][j] %= 573;
		nCr[i+1][j+1] %= 573;
	}
	ll ret = 1;
	for(int i=0;i<26;i++){
		ll t = nCr[n][cnt[i]];
		if(n == 0 || cnt[i] == 0)t = 1;
		ret *= t;
		ret %= 573;
		n -= cnt[i];
	}
	cout << ret-1 << endl;

	return 0;
}
0