class Solution {
public:
std::string ConvertToBase(long long number, int base) {
std::stack<std::string> representation_stack;
while(number > 0) {
std::lldiv_t div = std::lldiv(number, base);
long long digit = div.rem;
number = div.quot;
if (digit > 9) {
digit = digit - 9;
char letter = (char)('A' + digit - 1);
representation_stack.push(std::string(1, letter));
continue;
}
representation_stack.push(std::to_string(digit));
}
// convert the stack to a string
std::string rep_string = "";
while(!representation_stack.empty()) {
std::string character = representation_stack.top();
representation_stack.pop();
rep_string += character;
}
return rep_string;
}
string concatHex36(int n) {
long long number = n;
long long squared_num = std::pow(number, 2);
long long cubed_num = std::pow(number, 3);
std::string hexadecimal_string = ConvertToBase(squared_num, 16);
std::string hexatrigesimal_string = ConvertToBase(cubed_num, 36);
return hexadecimal_string + hexatrigesimal_string;
}
};