結果

問題 No.171 スワップ文字列(Med)
ユーザー HAHAHAHAHAHA
提出日時 2016-09-15 12:10:19
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 29 ms / 1,000 ms
コード長 489 bytes
コンパイル時間 2,607 ms
コンパイル使用メモリ 144,652 KB
実行使用メモリ 33,348 KB
最終ジャッジ日時 2023-08-10 20:36:24
合計ジャッジ時間 2,792 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
33,348 KB
testcase_01 AC 29 ms
33,204 KB
testcase_02 AC 28 ms
33,232 KB
testcase_03 AC 28 ms
33,184 KB
testcase_04 AC 29 ms
33,216 KB
testcase_05 AC 29 ms
33,276 KB
testcase_06 AC 29 ms
33,196 KB
testcase_07 AC 28 ms
33,312 KB
testcase_08 AC 29 ms
33,216 KB
testcase_09 AC 29 ms
33,240 KB
testcase_10 AC 29 ms
33,216 KB
testcase_11 AC 29 ms
33,172 KB
testcase_12 AC 29 ms
33,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;


long long mod=573;
int A[26];

const int MAX=2001;
long long C[MAX][MAX];

int main(){
	long long ret=1,len;
	string s;
	
	for(int i=0;i<MAX;i++){
		for(int j=0;j<=i;j++){
			C[i][j]=(j==0||j==i)?1:(C[i-1][j-1]+C[i-1][j])%mod;
		}
	}
	
	cin >> s;
	len=s.size();
	for(int i=0;i<s.size();i++) A[s[i]-'A']++;
	
	
	for(int i=0;i<26;i++) if(A[i]) {
		ret = ret * C[len][A[i]] % mod;
		len-=A[i];
	}
	
	cout << (ret+mod-1)%mod << endl;
	return 0;
}
0