結果

問題 No.2766 Delicious Multiply Spice
ユーザー matcharate12matcharate12
提出日時 2022-07-27 12:29:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 725 bytes
コンパイル時間 2,109 ms
コンパイル使用メモリ 171,548 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-31 20:50:05
合計ジャッジ時間 3,939 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(A) (A).begin(),(A).end()
using namespace std;
using ll = long long;

void solve(vector<string>& S,string ans,int n){
    if(n == 1) return;
    n--;
    if(n%2 == 0 && n/2 >= 1){
        ans.push_back('A');
        solve(S,ans,n/2);
        if(n/2 == 1) S.push_back(ans);
        ans.pop_back();
    }
    if(n%3 == 0 && n/3 >= 1){
        ans.push_back('B');
        solve(S,ans,n/3);
        if(n/3 == 1) S.push_back(ans);
        ans.pop_back();
    }
    return;
}

int main(){
    ll n; cin >> n;
    string ans = "";
    vector<string> S;
    solve(S,ans,n);
    if(S.size() >= 1) reverse(all(S[0]));
    if(S.size() >= 1) cout << S[0];
}
0