PATA1027题解
作者:互联网
#include<iostream> #include<math.h> using namespace std; const int INF = 1e9; const int MAXN = 3*1e5; int cost[MAXN], val[MAXN]; int N, num, a, b; int convert(int x) { int z[40], num = 0; do{ z[num++] = x % 13; x = x/13; }while(x!=0); char tempA, tempB; if(z[0] >= 10) tempA = z[0]-10 +'A'; else tempA = '0' + z[0]; if(z[1] >= 10) tempB = z[1]-10 +'A'; else tempB = '0' + z[1]; if(num == 1) cout << "0" << tempA; else cout << tempB << tempA; } int main() { cout << "#"; int a = 3; while(a--) { cin >> num; convert(num); } }
进制的转换
标签:10,tempA,tempB,int,题解,num,MAXN,PATA1027 来源: https://www.cnblogs.com/dcklm/p/10351488.html