結果

問題 No.2766 Delicious Multiply Spice
ユーザー MayimgMayimg
提出日時 2024-06-01 11:33:56
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 818 bytes
コンパイル時間 3,498 ms
コンパイル使用メモリ 268,084 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-01 11:34:05
合計ジャッジ時間 6,263 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 RE -
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 AC 2 ms
6,944 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 2 ms
6,944 KB
testcase_31 AC 2 ms
6,944 KB
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 AC 2 ms
6,940 KB
testcase_38 AC 3 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize "O3,omit-frame-pointer,inline"
#pragma GCC push_options
#pragma GCC optimize ("unroll-loops")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

signed main () {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  long long n;
  cin >> n;
  string ans;

  function<bool(long long)> dfs = [&](long long x) {
    if (x == 1) return true;
    cerr << "x = " << x << endl;
    x--;
    cerr << "x after decrement = " << x << endl;
    if (x % 2 == 0) {
      if (dfs(x / 2)) {
        ans += 'A';
        return true;
      }
    }
    if (x % 3 == 0) {
      if (dfs(x / 3)) {
        ans += 'B';
        return true;
      }
    }
    if ((x % 2 != 0) && (x % 3 != 0)) {
      return false;
    }
    assert(false);
  };

  dfs(n);

  cout << ans << endl;
  return 0;  
}


0