結果
| 問題 | No.52 よくある文字列の問題 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-01-18 06:31:24 | 
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 569 bytes | 
| コンパイル時間 | 4,705 ms | 
| コンパイル使用メモリ | 124,032 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-28 03:14:13 | 
| 合計ジャッジ時間 | 3,845 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 11 | 
ソースコード
// No.52 よくある文字列の問題
#include <iostream>
#include <string>
#include <set>
using namespace std;
int main() {
    string S;
    cin >> S;
    int N = S.size();
    set<string> st;
    for (int bit = 0; bit < (1 << N); ++bit) {
        int l = 0, r = N - 1;
        string T = "";
        for (int i = 0; i < N; ++i) {
            if (bit >> i & 1) {
                T += S[l];
                ++l;
            } else {
                T += S[r];
                --r;
            }
        }
        st.insert(T);
    }
    cout << st.size() << endl;
}
            
            
            
        