結果

問題 No.52 よくある文字列の問題
ユーザー ldsybldsyb
提出日時 2016-04-01 15:31:08
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 425 bytes
コンパイル時間 607 ms
コンパイル使用メモリ 65,732 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 05:25:58
合計ジャッジ時間 1,052 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <set>
using namespace std;

int main(){
   set<string> s;
   string str;
   cin >> str;
   const int STRSIZE = str.size();
   for(int i = 0;i < (1 << (STRSIZE - 1));i++){
      string tmp = "";
      int f = 0,e = STRSIZE - 1;
      for(int j = 0;j < STRSIZE - 1;j++) (i >> j) & 1 ? tmp += str[f++] : tmp += str[e--];
      tmp += str[f];
      s.insert(tmp);
   }
   cout << s.size() << endl;
}
0