結果

問題 No.171 スワップ文字列(Med)
ユーザー HAHAHAHAHAHA
提出日時 2016-09-15 12:10:19
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 30 ms / 1,000 ms
コード長 489 bytes
コンパイル時間 1,157 ms
コンパイル使用メモリ 158,840 KB
実行使用メモリ 27,388 KB
最終ジャッジ日時 2024-04-28 13:48:34
合計ジャッジ時間 2,382 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
25,984 KB
testcase_01 AC 30 ms
25,984 KB
testcase_02 AC 29 ms
26,112 KB
testcase_03 AC 29 ms
25,984 KB
testcase_04 AC 28 ms
25,984 KB
testcase_05 AC 30 ms
26,112 KB
testcase_06 AC 30 ms
25,984 KB
testcase_07 AC 29 ms
26,112 KB
testcase_08 AC 29 ms
27,388 KB
testcase_09 AC 29 ms
25,984 KB
testcase_10 AC 29 ms
25,984 KB
testcase_11 AC 29 ms
26,112 KB
testcase_12 AC 29 ms
26,112 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