結果

問題 No.52 よくある文字列の問題
ユーザー fiord
提出日時 2015-06-10 23:34:00
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 425 bytes
コンパイル時間 666 ms
コンパイル使用メモリ 66,132 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 05:21:33
合計ジャッジ時間 1,047 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <set>
using namespace std;
int main(){
	string s;	cin>>s;
	set<string> dic;
	int cnt=1<<(int)s.size();
	for(int t=0;t<cnt;t++){
		string temp;
		int num=t;
		int f=0,b=(int)s.size()-1;
		while(s.size()>temp.size()){
			if(num%2)	temp+=s[f++];
			else 	temp+=s[b--];
			num>>=1;
		}
		if(dic.find(temp)==dic.end())	dic.insert(temp);
	}
	cout<<(int)dic.size()<<endl;
	return 0;
}
0