結果
問題 | No.2766 Delicious Multiply Spice |
ユーザー |
|
提出日時 | 2024-05-31 22:31:36 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 535 bytes |
コンパイル時間 | 3,169 ms |
コンパイル使用メモリ | 246,236 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-21 00:11:18 |
合計ジャッジ時間 | 4,440 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 8 |
other | AC * 31 |
ソースコード
#include <bits/stdc++.h>#define rep(i, n) for (int i = 0; i < (n); ++i)using namespace std;using ll = long long;int main() {ll n;cin >> n;string ans;auto f = [&](auto& f, ll n, string t) -> void {if (n < 1) return;if (n == 1) {ans = t;return;}n--;if (n%3 == 0) f(f, n/3, t+'B');if (n%2 == 0) f(f, n/2, t+'A');};f(f, n, "");reverse(ans.begin(), ans.end());cout << ans << '\n';return 0;}