fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. #include <cstdint>
  4. #include <limits>
  5. std::string Radix62(std::uint64_t N){
  6. std::string Char = "0123456789abcdefghijklnmopqrstuvwxyzABCDEFGHIJKLNMOPQRSTUVWXYZ";
  7. std::string Ret;
  8. std::uint32_t Ch = 0;
  9. std::uint32_t Radix = 62;
  10. while (N != 0){
  11. Ch = N%Radix;
  12. N = (N - Ch) / Radix;
  13. Ret = Char[Ch] + Ret;
  14. }
  15. return Ret;
  16. }
  17.  
  18.  
  19.  
  20. int main(){
  21.  
  22. std::uint64_t N = std::numeric_limits<std::uint64_t>::max();
  23.  
  24. auto R = Radix62(N);
  25.  
  26. std::cout << N << "==" << R << std::endl;
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0s 3476KB
stdin
Standard input is empty
stdout
18446744073709551615==lYGhA16ahyf