結果
問題 | No.2766 Delicious Multiply Spice |
ユーザー |
![]() |
提出日時 | 2024-05-31 22:27:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 525 bytes |
コンパイル時間 | 2,027 ms |
コンパイル使用メモリ | 193,200 KB |
最終ジャッジ日時 | 2025-02-21 18:06:24 |
ジャッジサーバーID (参考情報) |
judge1 / 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;}