結果

問題 No.2766 Delicious Multiply Spice
ユーザー tobbietobbie
提出日時 2024-06-08 15:10:09
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 514 bytes
コンパイル時間 1,622 ms
コンパイル使用メモリ 167,924 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-12-28 01:19:24
合計ジャッジ時間 34,847 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 8
other AC * 23 TLE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i=0; i<(int)n; i++)
using ll = long long int;

int main() {
  ll N;
  cin >> N;
  auto dfs = [&](auto dfs, ll x, string S) {
    if (x == N) {
      rep(i, (int)S.size())
	cout << S[i];
      cout << endl;
      return true;
    }
    if (x > N)
      return false;
    bool ret = false;
    ret = (dfs(dfs, x * 2 + 1, S + 'A')) || ret;
    ret = (dfs(dfs, x * 3 + 1, S + 'B')) || ret;
    return ret;
  };
  dfs(dfs, 1, "");
  return 0;
}
0