Problem Description As we know , we always use the decimal system in our common life, even using the computer. If we want to calculate the value that 3 plus 9, we just import 3 and 9.after calculation of computer, we will get the result of 12. But af…
进制转化类题目类型: 代码详解及注释解答: //进制转化问题 #include <bits/stdc++.h> using namespace std; int main(){ // 1.反序数 123->321 // int n; // int sn = 0;//存取反序数 // scanf("%d", &n); // while( n!=0 ){ // sn = sn * 10; // sn += (n%10);//求出最后一位,即123的3 // n…
P1017进制转化 也不知道为啥,这么简单的题困扰了我这么长时间 #include<cstdio> using namespace std; int m; //被除数= 除数*商 + 余数 = 除数 *(商 + 1) + (余数 - 除数); void cal(int n) { if (n == 0) return; int p = n % m; n /= m; if (p < 0) p -= m, n++; cal(n); if (p <= 9) printf("%d&…