結果
| 問題 |
No.2766 Delicious Multiply Spice
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-07-28 10:36:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,049 bytes |
| コンパイル時間 | 2,007 ms |
| コンパイル使用メモリ | 168,568 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-20 22:04:11 |
| 合計ジャッジ時間 | 2,930 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 8 |
| other | AC * 23 WA * 8 |
ソースコード
#include <bits/stdc++.h>
#include <chrono>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rrep(i,a,b) for(int i = a; i < b; i++)
#define all(A) (A).begin(),(A).end()
#define MOD 1000000007
#define grt greater<int>()
#define mapf(M) for(auto& [k,v] : M)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using pq = priority_queue<ll,vector<ll>,greater<ll>>;
ll INF = 1LL<<60;
template <typename T>
bool chmax(T &a,T &b){ if(a < b){ a = b; return true; } return false; }
template <typename T>
bool chmin(T &a,T &b){ if(a > b){ a = b; return true; } return false; }
struct Edge { int to; int cost; int from; };
using Graph = vector<vector<Edge>>;
using vi = vector<int>;
string ans;
void dfs(string s,int x){
if(x == 1) return;
x--;
if(x%2 == 0){
s.push_back('A');
dfs(s,x/2);
if(x/2 == 1) ans = s;
s.pop_back();
}
if(x%3 == 0){
s.push_back('B');
dfs(s,x/3);
if(x/3 == 1) ans = s;
s.pop_back();
}
return;
}
int main(void){
int n; cin >> n;
string s = "";
dfs(s,n);
reverse(all(ans));
cout << ans;
}