結果
| 問題 |
No.2766 Delicious Multiply Spice
|
| コンテスト | |
| ユーザー |
nonon
|
| 提出日時 | 2024-05-31 21:27:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 558 bytes |
| コンパイル時間 | 2,167 ms |
| コンパイル使用メモリ | 199,564 KB |
| 最終ジャッジ日時 | 2025-02-21 17:30:02 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 8 |
| other | AC * 18 TLE * 1 -- * 12 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
long long N;
cin>>N;
string ans;
unordered_set<long>S;
auto f=[&](auto f, long long v)->void
{
if(v>N)return;
if(v==N)
{
cout<<ans<<endl;
exit(0);
}
if(S.count(v))return;
S.insert(v);
ans.push_back('B');
f(f,3*v+1);
ans.pop_back();
ans.push_back('A');
f(f,2*v+1);
ans.pop_back();
};
f(f,1);
}
nonon