結果
問題 |
No.2118 遺伝的有限集合の数え上げ
|
ユーザー |
👑 |
提出日時 | 2022-09-24 14:53:44 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 650 bytes |
コンパイル時間 | 799 ms |
コンパイル使用メモリ | 69,356 KB |
最終ジャッジ日時 | 2025-02-07 14:19:45 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 37 |
ソースコード
#include <iostream> #include <string> #include <stdio.h> #include <stdint.h> using namespace std; using uint = unsigned int; #define CIN( LL , A ) LL A; cin >> A #define QUIT return 0 #define RETURN( ANSWER ) cout << ( ANSWER ) << endl; QUIT #include <cassert> string EnumerateHereditarilyFiniteSets( uint n ) { string s{}; uint i = 0; while( n != 0 ){ if( n % 2 == 1 ){ s += "," + EnumerateHereditarilyFiniteSets( i ); } n /= 2; i++; } s = "{" + ( s == "" ? s : s.substr( 1 ) ) + "}"; return s; } int main() { CIN( uint , N ); assert( N <= 1000000 ); RETURN( EnumerateHereditarilyFiniteSets( N ) ); }