結果
| 問題 | No.2766 Delicious Multiply Spice |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-08 19:33:13 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 550 bytes |
| 記録 | |
| コンパイル時間 | 1,183 ms |
| コンパイル使用メモリ | 225,140 KB |
| 実行使用メモリ | 16,384 KB |
| 最終ジャッジ日時 | 2026-07-05 15:17:16 |
| 合計ジャッジ時間 | 3,646 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}