結果
問題 | No.170 スワップ文字列(Easy) |
ユーザー |
|
提出日時 | 2016-05-14 02:28:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,125 bytes |
コンパイル時間 | 1,602 ms |
コンパイル使用メモリ | 169,308 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 00:41:27 |
合計ジャッジ時間 | 2,354 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> #define INIT std::ios::sync_with_stdio(false);std::cin.tie(0); #define VAR(type, a) type a;std::cin>>a; // VAR(int, x); #define OUT(d) std::cout<<(d); #define SP std::cout<<" "; #define ENDL std::cout<<"\n"; #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i; #define MAT(type, c, m, n) std::vector<std::vector<type>> c(m, std::vector<type>(n));for(auto& r:c)for(auto& i:r)std::cin>>i; #define ALL(a) (a).begin(),(a).end() #define FOR(i,a,b) for (int i=(a);i<(b);++i) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) using ll = long long; ll Factrial(ll n){ if(!n) return 1; return n*Factrial(n-1); } signed main(){ INIT; VAR(std::string, s); std::sort(ALL(s)); int chara = '\0'; int cnt = 1; int ans = Factrial(s.size()); REP(i, s.size()){ if(chara!=s[i]){ ans /= Factrial(cnt); cnt = 1; }else{ ++cnt; } chara = s[i]; } ans /= Factrial(cnt); OUT(ans-1)ENDL; return 0; }