题解
2025-07-30 19:22:38
发布于:新疆
4阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int a,b;
string s1,s2;
int k;
void f(int x,int z){
if(x>=z){
f(x/z,z);
}
if(x%z>=10){
s1+=char(65+x%z-10);
}else{
s1+=char(x%z+49-1);
}
}
void d(int x,int z){
if(x>=z){
d(x/z,z);
}
if(x%z>=10){
s2+=char(65+x%z-10);
}else{
s2+=char(x%z+49-1);
}
}
int main(){
cin>>a>>b;
cin>>k;
f(a,k);
d(b,k);
cout<<max(s1,s2);
return 0;
}
这里空空如也
有帮助,赞一个