結果

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

ソースコード

diff #
プレゼンテーションモードにする

#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
auto f = [&](auto f, long long x) -> string {
if (x == 1) {
return "";
}
if ((x - 1) % 2 != 0 && (x - 1) % 3 != 0) {
return "X";
}
string res;
if ((x - 1) % 2 == 0) {
string s = f(f, (x - 1) / 2);
if (s != "X") {
res = "A" + s;
} else {
res = "B" + f(f, (x - 1) / 3);
}
} else {
res = "B" + f(f, (x - 1) / 3);
}
return res;
};
string ans = f(f, n);
reverse(ans.begin(), ans.end());
cout << ans << endl;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0