結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
10,456 KB
testcase_01 AC 10 ms
10,452 KB
testcase_02 AC 10 ms
10,400 KB
testcase_03 AC 11 ms
10,452 KB
testcase_04 AC 10 ms
10,304 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 10 ms
10,400 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 11 ms
10,580 KB
testcase_11 AC 10 ms
10,296 KB
testcase_12 AC 11 ms
10,296 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];
	}
	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