将数字向量从基数转换为基数
Converting vector of digits from base to base
如何在不使用 gmp 等库的情况下将基本a
中的vector<int>
转换为基本b
中的vector<int>
?
包含数字的数字。 a
和b
小于 1024。 a
可以小于或大于 b
。
我考虑过使用标准的基本转换算法,但即使在long long
中,这些数字也不适合。
我想过使用标准的基础转换算法,但即使在
long long
中,这些数字也不适合.
这是正确的(如:"干净"(方法。由于数字不适合本机数字类型,并且您不想使用现有库,因此您基本上需要实现自己的数字类型,或者至少实现转换算法所需的必要运算(加法、除法、模数(。
最简单(尽管不是最有效的(方法是实现经典的长除法算法。
相关文章:
- 将数字转换为字母(例如:123 转换为一二三)
- 将数字转换为单词
- 使用if-else将数字转换为单词
- 将数字转换为填充字符串
- 函数在许多数字上转换为基数 1 时减去 2?
- 为什么将双精度转换为 int 似乎在第 16 位数字之后将其四舍五入?
- 如何将 UTF-8 文本从文件转换为某个可以迭代的容器,并检查每个符号是否为C++字母数字?
- 将 C 函数转换为 C++ 以检查数字是否有效
- 编译时间文本到数字转换 (atoi)
- 以C++格式将字符串转换为数字
- 在 c++ 中将数字转换为矢量数组的函数
- 奇怪的数字转换C++
- 我想使用 std::stoi 函数在 cpp 中将字符串转换为整数,因为我想在字符串中找到不同数字的总和(在下级酶中)
- 用C++将浮点数字转换为本地化字符串
- 我需要静态转换我的数字模板值吗
- 如何将boost::asio::ip::address_v6 ip转换为2个uint64_t数字,并从2个uint 64
- Rcpp - 用二进制函数转换数字向量?
- 我如何使用堆栈转换数字从基数10到基数2在c++
- 如何在c++中从字节数组中的整数转换数字
- c++程序转换数字的位数