結果
問題 | No.2766 Delicious Multiply Spice |
ユーザー |
![]() |
提出日時 | 2024-05-31 23:11:25 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 648 bytes |
コンパイル時間 | 3,169 ms |
コンパイル使用メモリ | 245,800 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-21 01:30:17 |
合計ジャッジ時間 | 4,636 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 8 |
other | AC * 31 |
ソースコード
#include<bits/stdc++.h>using namespace std;#define rep(i,n) for(int i=0;i<(int)(n);i++)#define ALL(v) v.begin(),v.end()typedef long long ll;template <class T> using V=vector<T>;template <class T> using VV=V<V<T>>;int main(){ios::sync_with_stdio(false);std::cin.tie(nullptr);ll n;cin>>n;string s;auto f=[&](auto f,ll x,string& t)->void{if(x==1){reverse(ALL(t));cout<<t<<endl;exit(0);}if((x-1)%2==0){t+='A';f(f,(x-1)/2,t);t.pop_back();}if((x-1)%3==0){t+='B';f(f,(x-1)/3,t);t.pop_back();}};f(f,n,s);return 0;}