#include <iostream>
#include <string>
#include <cstdint>
#include <limits>
std::string Radix62c(std::uint64_t N, std::string buff) {
std::string const Char = "0123456789abcdefghijklnmopqrstuvwxyzABCDEFGHIJKLNMOPQRSTUVWXYZ";
int const Radix = 62;
return (N == 0) ? buff
: Radix62c(N / Radix, Char[N % Radix] + buff);
}
std::string Radix62b(std::uint64_t N) {
std::string const Char = "0123456789abcdefghijklnmopqrstuvwxyzABCDEFGHIJKLNMOPQRSTUVWXYZ";
int const Radix = 62;
return (N == 0) ? ""
: Radix62b(N / Radix) + Char[N % Radix];
}
std::string Radix62a(std::uint64_t N) {
std::string const Char = "0123456789abcdefghijklnmopqrstuvwxyzABCDEFGHIJKLNMOPQRSTUVWXYZ";
std::string Ret;
int const Radix = 62;
while (N != 0){
int Ch = N % Radix;
N /= Radix; /* changed */
Ret = Char[Ch] + Ret;
}
return Ret;
}
int main() {
std::uint64_t N = std::numeric_limits<std::uint64_t>::max();
std::cout << N << " == " << Radix62a(N) << std::endl;
std::cout << N << " == " << Radix62b(N) << std::endl;
std::cout << N << " == " << Radix62c(N, "") << std::endl;
return 0;
}
/* end */
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8Y3N0ZGludD4KI2luY2x1ZGUgPGxpbWl0cz4KCnN0ZDo6c3RyaW5nIFJhZGl4NjJjKHN0ZDo6dWludDY0X3QgTiwgc3RkOjpzdHJpbmcgYnVmZikgewogIHN0ZDo6c3RyaW5nIGNvbnN0IENoYXIgPSAiMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG5tb3BxcnN0dXZ3eHl6QUJDREVGR0hJSktMTk1PUFFSU1RVVldYWVoiOwogIGludCBjb25zdCBSYWRpeCA9IDYyOwogIHJldHVybiAoTiA9PSAwKSA/IGJ1ZmYKICAgICAgICAgICAgICAgICAgOiBSYWRpeDYyYyhOIC8gUmFkaXgsIENoYXJbTiAlIFJhZGl4XSArIGJ1ZmYpOwp9CgpzdGQ6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