标签:out 字符 bsp nbsp 字符串 ++ amp 不为 ==
#include <iostream> #include <string> using namespace std; int main() { string num; int a, b, m; cin >> num >> m; // 一个为字符串一个为整形数字避免了麻烦的处理 int len = num.size(); a = (num[0] - ‘0‘) / m; b = (num[0] - ‘0‘) % m; if (len == 1 || (len > 1 && a != 0)) // 判断数字的第一个是否为零,位数为1的情况,不为1的情况 cout << a; for (int i = 1; i < len; i++) { a = (b * 10 + (num[i] - ‘0‘)) / m; cout << a; b = (b * 10 + (num[i] - ‘0‘)) % m; } cout << " " << b; return 0; }
标签:out 字符 bsp nbsp 字符串 ++ amp 不为 ==
原文地址:https://www.cnblogs.com/Hk456/p/10798758.html