結果

問題 No.171 スワップ文字列(Med)
ユーザー cocolleague
提出日時 2017-02-04 17:46:52
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 6 ms / 1,000 ms
コード長 607 bytes
コンパイル時間 1,597 ms
コンパイル使用メモリ 166,048 KB
実行使用メモリ 10,112 KB
最終ジャッジ日時 2024-12-24 06:16:58
合計ジャッジ時間 2,305 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
static const int INF = 1e8;
const ll MOD = 573;
ll cmb[1024][1024];
void comb(){
	cmb[0][0] = 1;
	for(int i = 0; i < 1024; i++){
		cmb[i][0] = 1;
		for(int j = 1;j <=i;j++){
			cmb[i][j] = (cmb[i-1][j]+cmb[i-1][j-1] % MOD);
		}
	}
}
int main(void){
	comb();
	string s;
	cin >> s;
	int n = s.size();
	map<char,int> m;
	for(char c: s){
		m[c]++;
	}
	ll ans = 1;
	for(auto el : m){
		ans *= cmb[n][el.second];
		n   -= el.second;
		ans %= MOD;
	}
	cout << (ans - 1 + MOD) % MOD << endl;
	return 0;

 }
0