結果
問題 | No.52 よくある文字列の問題 |
ユーザー | springroll |
提出日時 | 2018-11-18 16:48:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 655 bytes |
コンパイル時間 | 1,689 ms |
コンパイル使用メモリ | 175,920 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 05:37:42 |
合計ジャッジ時間 | 2,119 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
#include "bits/stdc++.h" using namespace std; int main() { string s; cin >> s; int n = s.length(); set<string> strs; list<char> chs; for (int i = 0; i < n; i++) { chs.push_back(s[i]); } for (int bit = 0; bit < (1 << n); bit++) { list<char> tmp_chs=chs; string str; for (int i = 0; i < n; i++) { if (bit&(1 << i)) { str.push_back(tmp_chs.back()); tmp_chs.pop_back(); } else { str.push_back(tmp_chs.front()); tmp_chs.pop_front(); } } //cout <<" "<< str << endl; strs.insert(str); } for (auto itr = strs.begin(); itr != strs.end(); itr++) { //cout << *itr << endl; } cout << strs.size() << endl; }