結果

問題 No.52 よくある文字列の問題
コンテスト
ユーザー notetonous
提出日時 2017-08-03 21:48:55
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 5,000 ms
+ 564µs
コード長 445 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 390 ms
コンパイル使用メモリ 84,520 KB
実行使用メモリ 9,780 KB
最終ジャッジ日時 2026-09-02 05:19:03
合計ジャッジ時間 1,637 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <string>
#include <algorithm>
#include <set>
using namespace std;
int main(){
  set<string> se;
  string s;
  cin >> s;
  for(int i=0;i< (1<<s.size())-1;i++){
    int x=i;
    string t=s,work="";
    for(int j=0;j<s.size();j++){
      if(x%2==0){work+=t[0];t.erase(t.begin());}
      else{work+=t[t.size()-1];t.erase(t.end()-1);}
      x/=2;
    }
    se.insert(work);
  }
  cout << se.size() << endl;
  return 0;
}
0