結果

問題 No.52 よくある文字列の問題
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2024-01-01 21:53:36
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 810 bytes
コンパイル時間 5,244 ms
コンパイル使用メモリ 313,916 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-01 21:53:42
合計ジャッジ時間 5,855 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 1 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 1 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>


using namespace std;
using namespace atcoder;
#define rep(i,m,n,k) for (int i = (int)(m); i < (int)(n); i += (int)(k))
#define rrep(i,m,n,k) for (int i = (int)(m); i > (int)(n); i += (int)(k))
#define ll long long
#define list(T,A,N) vector<T> A(N);for(int i=0;i<(int)(N);i++){cin >> A[i];}


int main(){
    
    string S;
    cin >> S;
    int N = (int)(S.size());
    set<string> X;
    string tmp;
    int l,r;
    rep(i,0,1<<N,1){

        l = 0;
        r = N-1;
        tmp = "";
        rep(j,0,N,1){
            if ((i>>j)&1){
                tmp += S[l];
                l += 1;
            }
            else{
                tmp += S[r];
                r -= 1;
            }
        };
        X.insert(tmp);
    };
    cout << X.size() << endl;
}
0