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