結果
| 問題 |
No.171 スワップ文字列(Med)
|
| コンテスト | |
| ユーザー |
moti
|
| 提出日時 | 2015-04-09 10:26:41 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 644 bytes |
| コンパイル時間 | 1,214 ms |
| コンパイル使用メモリ | 158,440 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2024-07-04 13:21:54 |
| 合計ジャッジ時間 | 1,824 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
int const MOD = 573;
ll comb[1010][1010];
void make_comb(int n) {
rep(i, n+1) {
comb[i][0] = 1;
REP(j, 1, i+1) {
comb[i][j] = comb[i-1][j-1] + comb[i-1][j];
comb[i][j] %= MOD;
}
}
}
int main() {
make_comb(1005);
string s; cin >> s;
int sz = s.size();
int mp[26]={};
rep(i, sz) { mp[s[i]-'A']++; }
ll ans = 1;
rep(i, 26) {
if(mp[i]) {
(ans *= (comb[sz][mp[i]]%MOD))%=MOD;
sz -= mp[i];
}
}
cout << ans-1 << endl;
return 0;
}
moti