結果

問題 No.171 スワップ文字列(Med)
ユーザー mint6421mint6421
提出日時 2019-08-02 21:55:16
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 6 ms / 1,000 ms
コード長 1,150 bytes
コンパイル時間 1,545 ms
コンパイル使用メモリ 172,120 KB
実行使用メモリ 11,412 KB
最終ジャッジ日時 2023-09-18 18:28:55
合計ジャッジ時間 2,405 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
11,092 KB
testcase_01 AC 5 ms
11,160 KB
testcase_02 AC 6 ms
11,124 KB
testcase_03 AC 5 ms
11,108 KB
testcase_04 AC 5 ms
11,112 KB
testcase_05 AC 5 ms
11,116 KB
testcase_06 AC 5 ms
11,100 KB
testcase_07 AC 6 ms
11,096 KB
testcase_08 AC 6 ms
11,240 KB
testcase_09 AC 5 ms
11,412 KB
testcase_10 AC 5 ms
11,104 KB
testcase_11 AC 5 ms
11,116 KB
testcase_12 AC 5 ms
11,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)573
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>

int c[1100][1100];


void comb_table(void){
  for(int i=0;i<=1000;i++){
    for(int j=0;j<=i;j++){
      if(j==0||j==i){
        c[i][j] = 1LL;
      }
      else{
        c[i][j]=(c[i-1][j-1]+c[i-1][j])%M;
      }
    }
  }
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  comb_table();

  string s;
  cin>>s;

  map<char,int> mp;
  for(auto c:s){
    mp[c]++;
  }

  int ans=1;
  int n=s.size();

  for(auto e:mp){
    ans*=c[n][e.S];
    ans%=M;
    n-=e.S;
  }

  cout<<(ans-1+M)%M<<endl;

}
0