結果
| 問題 | No.2766 Delicious Multiply Spice | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-05-27 16:13:19 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 362 bytes | 
| コンパイル時間 | 1,751 ms | 
| コンパイル使用メモリ | 168,108 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-12-20 22:08:11 | 
| 合計ジャッジ時間 | 2,947 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 8 | 
| other | AC * 31 | 
ソースコード
#include <bits/stdc++.h>
#define all(A) (A).begin(),(A).end()
using namespace std;
using ll = long long;
string ans,s = "";
void dfs(string s,ll i){
	if(i == 1){
		ans = s;
		return;
	}
	i--;
	if(i%2 == 0) dfs(s+'A',i/2);
	if(i%3 == 0) dfs(s+'B',i/3);
}
int main(void){
	ll n; cin >> n;
	assert(n <= (ll)1e18);
	dfs(s,n);
	reverse(all(ans));
	cout << ans;
}
            
            
            
        