結果

問題 No.2118 遺伝的有限集合の数え上げ
ユーザー kotatsugame
提出日時 2022-11-04 21:26:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 256 bytes
コンパイル時間 667 ms
コンパイル使用メモリ 65,024 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-18 19:09:41
合計ジャッジ時間 1,706 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 37
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   15 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
string S(int N)
{
	if(N==0)return"{}";
	else
	{
		string ret="{";
		for(int i=0;1<<i<=N;i++)if(N>>i&1)ret+=S(i),ret+=',';
		ret.pop_back();
		ret+='}';
		return ret;
	}
}
main()
{
	int N;cin>>N;
	cout<<S(N)<<endl;
}
0