結果
| 問題 |
No.170 スワップ文字列(Easy)
|
| コンテスト | |
| ユーザー |
yosupot
|
| 提出日時 | 2015-03-22 23:30:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 768 bytes |
| コンパイル時間 | 572 ms |
| コンパイル使用メモリ | 68,516 KB |
| 実行使用メモリ | 17,912 KB |
| 最終ジャッジ日時 | 2024-06-29 00:11:35 |
| 合計ジャッジ時間 | 1,520 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 4 |
ソースコード
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <cassert>
#include <cstdio>
using namespace std;
typedef long long ll;
int comb[1919][1919];
void init() {
comb[0][0] = 1;
for (int i = 1; i < 1919; i++) {
comb[i][0] = 1;
for (int j = 1; j < 1919; j++) {
comb[i][j] = (comb[i-1][j] + comb[i-1][j-1]) % 573;
}
}
}
int d[26];
int main() {
init();
string s;
cin >> s;
int n = (int)s.size();
for (char c: s) {
d[c-'A']++;
}
ll res = 1;
for (int i = 0; i < 26; i++) {
res *= comb[n][d[i]];
n -= d[i];
res %= 573;
}
cout << (res + 572) % 573 << endl;
return 0;
}
yosupot