結果

問題 No.2118 遺伝的有限集合の数え上げ
ユーザー a01sa01to
提出日時 2024-12-26 00:50:57
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 535 bytes
コンパイル時間 3,682 ms
コンパイル使用メモリ 247,384 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 00:51:03
合計ジャッジ時間 5,030 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
#else
  #define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

int main() {
  int n;
  cin >> n;
  function<string(int)> f = [&](int i) {
    string s = "{";
    for (int x = 0; (1 << x) <= i; ++x) {
      if (i & (1 << x)) {
        if (s != "{") s += ',';
        s += f(x);
      }
    }
    s += "}";
    return s;
  };
  cout << f(n) << endl;
  return 0;
}
0