結果
問題 | No.52 よくある文字列の問題 |
ユーザー |
![]() |
提出日時 | 2014-10-29 00:03:09 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 481 bytes |
コンパイル時間 | 1,511 ms |
コンパイル使用メモリ | 168,704 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 05:17:52 |
合計ジャッジ時間 | 2,055 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
#include <bits/stdc++.h> using namespace std; string gen(string a,int m) { if(!a.size()) return ""; string answer; if(m&1) answer = a[a.size()-1] + gen(string(a.begin(),a.end()-1),m>>1); else answer = a[0] + gen(string(a.begin()+1,a.end()),m>>1); return answer; } int main() { string s; set<string> alls; int answer = 0; cin >> s; for(int i=0;i<(1<<s.size());i++) if(alls.insert(gen(s,i)).second) answer++; cout << answer << endl; return 0; }