文章

10

粉丝

0

获赞

0

访问

2.0k

头像
进制转换3 题解:
P1422 清华大学/厦门大学机试题
发布于2024年7月20日 20:48
阅读数 183

#include<bits/stdc++.h>
using namespace std;

void f(int M, int N,char x[]){
    long long ans = 0;
    int len = strlen(x);
    for (int i = 0; i < len; i++){
        ans = ans * M;
        if(x[i] >= '0' && x[i] <= '9'){
            ans += (x[i] - '0');
        }else{
            ans += (x[i] - 'A') + 10;
        }
    }
    
    if (ans == 0) {
        printf("0\n");
        return;
    }
    
    char out[105];
    int cnt = 0;
    while(ans > 0){
        int w =...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发