AC代码

#include <cstdio>
const int max_n = 1000;
int ans[max_n];
char result[max_n];
char radix[13] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C'};
int time = 0;
void change(int a) {
    int num = 0;
    if(a <= 13) { //根据位数来确定是否需要输出多余的0
        result[time++] = '0';
        result[time++] = radix[a];
    } else {
        do {
            ans[num++] = a % 13;
            a /= 13;
        } while(a != 0);
        for(int i = num - 1; i >=0; i--) {
            result[time++] = radix[ans[i]];
        }
    }
}

int main() {
    #ifdef ONLINE_JUDGE
    #else
        freopen("1.txt", "r", stdin);
    #endif // ONLINE_JUDGE}
    int a[3] = {0};
    scanf("%d%d%d", &a[0], &a[1], &a[2]);
    for(int i = 0; i < 3; i++) {
        change(a[i]);
    }
    printf("#");
    for(int i = 0; i < time; i++) {
        printf("%c", result[i]);
    }
    return 0;
}

相关文章:

  • 2021-08-10
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2021-07-20
  • 2021-11-17
  • 2021-06-18
猜你喜欢
  • 2021-07-11
  • 2021-08-11
  • 2021-09-13
  • 2021-10-16
  • 2022-12-23
  • 2022-01-18
相关资源
相似解决方案