結果

問題 No.2766 Delicious Multiply Spice
ユーザー kaede2020
提出日時 2024-05-31 21:37:16
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 692 bytes
コンパイル時間 10,498 ms
コンパイル使用メモリ 336,432 KB
実行使用メモリ 13,640 KB
最終ジャッジ日時 2024-12-20 22:45:29
合計ジャッジ時間 32,984 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 8
other AC * 23 TLE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
//using mint = modint998244353;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};

ll n;
string f(ll x, string a) {
    if (x == n) return a;
    if (x * 2ll <= n) {
        string res = f(x * 2ll+1ll, a + 'A');
        if (!res.empty()) return res;
    }
    if (x * 3ll <= n) {
        string res2 = f(x * 3ll+1, a + 'B');
        if (!res2.empty()) return res2;
    }
    return ""; 
}

int main() {
    cin >> n;
    ll x = 1;
    string a;
    a = f(x, "");
    cout << a << endl; // 結果を表示
    return 0;
}
0