結果

問題 No.2766 Delicious Multiply Spice
ユーザー ロロット
提出日時 2025-07-14 10:32:44
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 423 bytes
コンパイル時間 2,797 ms
コンパイル使用メモリ 278,408 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-07-14 10:32:52
合計ジャッジ時間 7,235 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 TLE * 1 -- * 5
other -- * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;cin>>n;
    vector<char>ans;
    while(n!=1){
        if(n%2==1) {n--;n/=2; ans.push_back('A');}
        if(n%3==1){n--;n/=3; ans.push_back('B');}
    }
    reverse(ans.begin(),ans.end());
    for(auto x:ans) cout << x;
}
0