結果
| 問題 |
No.171 スワップ文字列(Med)
|
| コンテスト | |
| ユーザー |
zange
|
| 提出日時 | 2015-03-23 00:12:20 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 602 bytes |
| コンパイル時間 | 341 ms |
| コンパイル使用メモリ | 55,700 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-29 00:18:18 |
| 合計ジャッジ時間 | 1,326 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 2 WA * 4 RE * 4 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
#define MOD 573
void count(string S, int countList[26]) {
int n = S.size();
for (int j = 0; j < n; j++) {
for (int i = 0; i < 26; i++) {
if (S[j] == (char)(i+'A')) countList[i]++;
}
}
}
int main() {
string S;
cin >> S;
int ans;
int countList[26] = {};
int fact[1001];
fact[0] = 1;
for (int i = 1; i < 1000; i++) {
fact[i] = (fact[i-1] * i) % MOD;
}
count(S, countList);
ans = fact[S.size()];
for (int i = 0; i < 26; i++) {
ans /= fact[countList[i]];
ans %= MOD;
}
ans--;
cout << ans << endl;
return 0;
}
zange