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