結果

問題 No.171 スワップ文字列(Med)
ユーザー ttakanottakano
提出日時 2017-12-06 21:03:03
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 838 bytes
コンパイル時間 1,425 ms
コンパイル使用メモリ 144,996 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-19 09:50:05
合計ジャッジ時間 9,463 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define printall(n,array) for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7

string s;
int cnt[27];

ll ncr[10010][10010];

//nCnまで計算
void nCr(int n){
  REP(i,n+1)REP(j,i+1){
    if(j==0)ncr[i][j]=1;
    else ncr[i][j]=ncr[i-1][j]+ncr[i-1][j-1];
  }
}

ll nPn(int n){
  ll sum=1;
  rep(i,1,n+1){
    sum*=i;
    sum%=573;
  }
  return sum;
}

int main(){
  cin>>s;
  REP(i,s.size())REP(j,26)if(s[i]-'A'==j)cnt[j]++;
  ///printall(26,cnt);///
  ll ans=nPn(s.size());
  REP(i,26)ans/=nPn(cnt[i]);
  print(ans-1);
}
0