結果
| 問題 |
No.2766 Delicious Multiply Spice
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-08 19:33:13 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 550 bytes |
| コンパイル時間 | 2,279 ms |
| コンパイル使用メモリ | 203,736 KB |
| 最終ジャッジ日時 | 2025-02-24 05:48:32 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 8 |
| other | WA * 31 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
map<ll,string> MP;
string D(ll N){
cout<<N<<endl;
if(N==1)return "";
else if(MP.count(N))return MP[N];
string res="?";
if(N%2==1){
string T=D(N/2);
if(T!="?"){
MP[N]=T+"A";
return MP[N];
}
}
if(N%3==1){
string T=D(N/3);
if(T!="?"){
MP[N]=T+"B";
return MP[N];
}
}
MP[N]=res;
return res;
}
int main() {
ll N;
cin>>N;
cout<<D(N)<<endl;
}