結果

問題 No.171 スワップ文字列(Med)
ユーザー ttakano
提出日時 2017-12-06 21:03:03
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 838 bytes
コンパイル時間 1,401 ms
コンパイル使用メモリ 158,556 KB
実行使用メモリ 12,064 KB
最終ジャッジ日時 2024-11-29 01:14:19
合計ジャッジ時間 17,645 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 WA * 4 TLE * 4
権限があれば一括ダウンロードができます

ソースコード

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