結果

問題 No.171 スワップ文字列(Med)
ユーザー ttakanottakano
提出日時 2017-12-06 21:29:00
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 820 bytes
コンパイル時間 1,170 ms
コンパイル使用メモリ 145,068 KB
実行使用メモリ 125,740 KB
最終ジャッジ日時 2023-08-19 09:53:01
合計ジャッジ時間 2,475 ms
ジャッジサーバーID
(参考情報)
judge10 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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;
ll cnt[27];

ll ncr[10010][10010];


int main(){
  cin>>s;
  REP(i,s.size())REP(j,26)if(s[i]-'A'==j)cnt[j]++;
  //print(s.size());///
  printall(26,cnt);///
  REP(i,2001)REP(j,i+1)ncr[i][j]=(j==0||j==i)?1:(ncr[i-1][j-1]+ncr[i-1][j])%573;
  ll ret=1;
  ll rest=s.size();
  REP(i,26)if(cnt[i]){
    ret=ret*ncr[rest][cnt[i]]%573;
    rest-=cnt[i];
    print(i<<" "<<ret<<" "<<rest)///
  }

  print((ret+573-1)%573);
}
0