結果
問題 |
No.170 スワップ文字列(Easy)
|
ユーザー |
![]() |
提出日時 | 2018-10-08 21:04:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 510 bytes |
コンパイル時間 | 1,815 ms |
コンパイル使用メモリ | 169,780 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 15:43:43 |
合計ジャッジ時間 | 2,693 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 3 |
ソースコード
#include <bits/stdc++.h> using namespace std; int kai(int n) { if(n == 1) return 1; return n * kai(n-1); } int main() { string s; cin >> s; vector<int> cnt(26,0); for(int i = 0; i < s.length(); i++) cnt[s[i]-'A']++; int a,b,c = 0; a = kai(s.length()); for(int i = 0; i < 26; i++){ if(cnt[i] <= 1) continue; b = kai(cnt[i]); if(b > 1) c += b; } if(!c) c = 1; cout << a / c - 1 << endl; return 0; }