結果
問題 |
No.52 よくある文字列の問題
|
ユーザー |
👑 |
提出日時 | 2020-03-01 19:54:51 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 651 bytes |
コンパイル時間 | 1,681 ms |
コンパイル使用メモリ | 81,836 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 20:48:10 |
合計ジャッジ時間 | 1,754 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ string s;cin>>s; vector<string> ret; for(int bit = 0; (1<<s.size()) > bit; bit++){ int nwl = 0; int nwr = s.size()-1; string t = ""; for(int i = 0; s.size() > i; i++){ if(bit & (1<<i)){ t.push_back(s[nwl]); nwl++; }else{ t.push_back(s[nwr]); nwr--; } } ret.push_back(t); } sort(ret.begin(),ret.end()); ret.erase(unique(ret.begin(),ret.end()),ret.end()); cout << ret.size() << endl; }