文章

13

粉丝

43

获赞

4

访问

3.4k

头像
进制转换3 题解:
Kohi VIP
P1422 清华大学/厦门大学机试题
发布于2024年3月17日 19:26
阅读数 393

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

string division(string s, const int &from, const int &to, int &remain){
    remain = 0;
    for(int i = 0; i < s.size(); i++){
        int temp = remain * from + s[i];
        if(s[i] >= '0' && s[i] <= '9'){
            temp -= '0';
        }
        else{
            temp = temp + 10 - 'A';
        }
        remain = temp % to;
        temp /= to;
        if(temp >= 0 && temp <= 9){
            s[i] = temp + '0';
        }
        else{
            s[i] = temp - 10 + 'A';
    &...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发