結果
| 問題 | No.52 よくある文字列の問題 | 
| コンテスト | |
| ユーザー |  Ysmr_Ry | 
| 提出日時 | 2014-11-16 16:14:46 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 445 bytes | 
| コンパイル時間 | 683 ms | 
| コンパイル使用メモリ | 66,604 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-22 05:18:08 | 
| 合計ジャッジ時間 | 1,228 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 11 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:28:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::set<std::__cxx11::basic_string<char> >::size_type’ {aka ‘long unsigned int’} [-Wformat=]
   28 |         printf( "%d\n", set.size() );
      |                  ~^     ~~~~~~~~~~
      |                   |             |
      |                   int           std::set<std::__cxx11::basic_string<char> >::size_type {aka long unsigned int}
      |                  %ld
            
            ソースコード
#include<iostream>
#include<string>
#include<set>
#define rep(i,a) for(int i=0;i<(a);++i)
std::string S;
std::set<std::string> set;
void rec( int lb, int ub, std::string s )
{
	if( lb == ub )
	{
		set.insert( s+S[lb] );
		return;
	}
	rec( lb+1, ub, s+S[lb] );
	rec( lb, ub-1, s+S[ub] );
	return;
}
int main()
{
	std::cin >> S;
	rec( 0, S.size()-1, std::string() );
	printf( "%d\n", set.size() );
	return 0;
}
            
            
            
        