首页 > 其他 > 详细

PATA1027题解

时间:2019-02-04 10:25:06      阅读:189      评论:0      收藏:0      [点我收藏+]
#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);
    }
}

进制的转换

PATA1027题解

原文:https://www.cnblogs.com/dcklm/p/10351488.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!