T6题解
2025-07-29 12:37:23
发布于:浙江
1阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
long long a,b;
int r;
int main(){
cin>>a>>b>>r;
string s,o;
char q[50000],u[50000];
int i=0,k=0;
while(b){
if(b%r>=10){
q[i]=char(b%r+55);
}
else{
q[i]=b%r+'0';
}
i++;
b/=r;
}
for(int j=i-1;j>=0;j--) s+=q[j];
while(a){
if(a%r>=10){
u[k]=char(a%r+55);
}
else{
u[k]=a%r+'0';
}
k++;
a/=r;
}
for(int j=k-1;j>=0;j--) o+=u[j];
if(o>s) cout<<o;
else cout<<s;
return 0;
}
这里空空如也
有帮助,赞一个