結果

問題 No.171 スワップ文字列(Med)
ユーザー togatogatogatoga
提出日時 2015-04-05 18:47:50
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 829 bytes
コンパイル時間 1,328 ms
コンパイル使用メモリ 144,220 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-17 04:35:57
合計ジャッジ時間 2,321 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 RE -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 WA -
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long, long> pll;

const int INF = 1 << 29;
const double EPS = 1e-9;
const int MOD = 573;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
string str;
int N;
int num[30];
int main() {
  cin >> str;
  N = str.length();
  for (int i = 0; i < N; i++){
    num[str[i] - 'A']++;
  }
  int sum = 1;
  for (int i = 1; i <= N; i++){
    sum *= i;
    sum %=MOD;
  }
//  cout << sum << endl;
  int tmp = 1;
  for (int i = 0; i < 26; i++){
    for (int j = 1; j <= num[i]; j++){
      tmp *= j;
      tmp %= MOD;
    }
  }
  cout << (sum / tmp - 1) % MOD << endl;
  return 0;
}
0