void print(long long int x, int cap);
void ma(long long int num, int rdx, int cap,int flag)
{
if(num<rdx)print(num, cap);
else
{
ma(num/rdx, rdx, cap,flag);
if(flag==1&&num==9223372036854775807)print(num%rdx+1, cap);
else print(num%rdx, cap);
}
}
void print(long long int x, int cap)
{
if(x<=9&&x>=0)
printf("%d",x);
else
{
if(cap)printf("%c",x+55);
else printf("%c",x+87);
}
}
void PrintRdx(long long int num, int rdx, int cap)
{
int flag=0;
if(num==-9223372036854775808&&rdx==2)
printf("-1000000000000000000000000000000000000000000000000000000000000000");
else
{
if(num==-9223372036854775808)
{
num=9223372036854775807;
flag=1;
printf("-");
}
else if(num<0)
{
num=-num;
printf("-");
}
ma(num, rdx, cap,flag);
}
}
不知道为什么错了的进制转化 DeBug
最新推荐文章于 2022-04-18 20:32:32 发布