結果
| 問題 |
No.2766 Delicious Multiply Spice
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-31 21:25:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 360 bytes |
| コンパイル時間 | 881 ms |
| コンパイル使用メモリ | 66,784 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-20 22:16:30 |
| 合計ジャッジ時間 | 2,243 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 8 |
| other | AC * 31 |
ソースコード
#include<iostream>
#include<cassert>
using namespace std;
string solve(long N)
{
if(N==1)return"";
N--;
if(N%2==0)
{
string t=solve(N/2);
if(t!="NA")return t+'A';
}
if(N%3==0)
{
string t=solve(N/3);
if(t!="NA")return t+'B';
}
return"NA";
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
long N;cin>>N;
cout<<solve(N)<<endl;
}