結果
| 問題 |
No.2766 Delicious Multiply Spice
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-31 21:27:32 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 22 ms / 2,000 ms |
| コード長 | 534 bytes |
| コンパイル時間 | 2,099 ms |
| コンパイル使用メモリ | 195,340 KB |
| 最終ジャッジ日時 | 2025-02-21 17:29:48 |
|
ジャッジサーバー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;
}