結果
| 問題 |
No.2766 Delicious Multiply Spice
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-31 23:15:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 669 bytes |
| コンパイル時間 | 1,788 ms |
| コンパイル使用メモリ | 170,220 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-21 01:31:56 |
| 合計ジャッジ時間 | 3,375 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 8 |
| other | AC * 23 WA * 8 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define REP(i,n) for(int i=0;i<int(n);i++)
string ans;
void dfs(int x,string s){
if(x==1){
reverse(s.begin(),s.end());
ans=s;
return;
}
if((x-1)%2!=0 && (x-1)%3!=0) return;
string t=s;
if((x-1)%2==0){
s+="A";
dfs((x-1)/2,s);
}
if((x-1)%3==0){
t+="B";
dfs((x-1)/3,t);
}
}
int main(){
cin.tie(nullptr); ios_base::sync_with_stdio(false);
int i,j,k;
ll N;
cin >> N;
if(N==1){
cout << "" << endl;
return 0;
}
dfs(N,"");
cout << ans << endl;
return 0;
}