結果

問題 No.2766 Delicious Multiply Spice
ユーザー ripity
提出日時 2024-05-15 17:40:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 382 bytes
コンパイル時間 2,008 ms
コンパイル使用メモリ 197,092 KB
最終ジャッジ日時 2025-02-21 14:14:49
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 8
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

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

long long N;
vector<string> ans_all;

void dfs(long long x, string S) {
  if(x == 1) {
    ans_all.push_back(S);
  }else {
    if((x - 1) % 2 == 0) dfs((x - 1) / 2, 'A' + S);
    if((x - 1) % 3 == 0) dfs((x - 1) / 3, 'B' + S);
  }
}

int main() {
  cin >> N;
  dfs(N, "");
  assert(ans_all.size() == 1);
  cout << ans_all[0] << endl;
}
0