結果

問題 No.171 スワップ文字列(Med)
ユーザー tkzw_21tkzw_21
提出日時 2015-03-22 23:40:20
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 604 bytes
コンパイル時間 1,177 ms
コンパイル使用メモリ 146,064 KB
実行使用メモリ 10,576 KB
最終ジャッジ日時 2023-09-11 09:35:06
合計ジャッジ時間 2,040 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
10,240 KB
testcase_01 AC 11 ms
10,244 KB
testcase_02 AC 11 ms
10,296 KB
testcase_03 AC 11 ms
10,300 KB
testcase_04 AC 11 ms
10,248 KB
testcase_05 WA -
testcase_06 AC 11 ms
10,576 KB
testcase_07 AC 12 ms
10,248 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 11 ms
10,256 KB
testcase_11 AC 11 ms
10,508 KB
testcase_12 AC 11 ms
10,240 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[1001][1001];

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]];
		ret *= t;
		ret %= 573;
		n -= cnt[i];
	}
	cout << ret-1 << endl;

	return 0;
}
0