結果
問題 | No.2766 Delicious Multiply Spice |
ユーザー |
![]() |
提出日時 | 2024-05-31 22:27:56 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 525 bytes |
コンパイル時間 | 2,281 ms |
コンパイル使用メモリ | 200,720 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-21 00:07:20 |
合計ジャッジ時間 | 3,469 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 8 |
other | AC * 31 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {long long n;cin >> n;string ans = "";auto f = [&](auto f, long long x) -> bool {if (x == 1) {return true;}if ((x - 1) % 2 == 0 && f(f, (x - 1) / 2) == true) {ans += "A";return true;}if ((x - 1) % 3 == 0 && f(f, (x - 1) / 3) == true) {ans += "B";return true;}return false;};f(f, n);cout << ans << endl;}