EGGY_PRATE @ 2024-08-20 13:49:10
#include <bits/stdc++.h>
using namespace std;
int main(){
long long n,m;
cin>>n>>m;
string s="",s2="0123456789ABCDEFGHIJKLMNOPQRSTUVWYZ";
while(n!=0){
long long x=n%m;
s=s2[x]+s;
n=n/m;
}
cout<<s;
}
80分,救我!!!!!!
by EGGY_PRATE @ 2024-08-20 14:20:13
@xuxiyuan1112 那我怎么过的
by xuxiyuan1112 @ 2024-08-20 14:24:54
@EGGY_PRATE 你怎么写的
by Urbosa @ 2024-08-25 11:54:28
直接cout<<s是不是不行?
#include <bits/stdc++.h>
using namespace std;
long long x[11451],i,n,g,jz,cnt;
int main() {
cin>>n;
cin>>jz;
for(i=1;i<=99999;i++){
cnt++;
g=n;
x[i]=g%jz;
n/=jz;
if(n==0){
break;
}
}
for(long long k=cnt;k>=1;k--){
if(x[k]>=0&&x[k]<10){
cout<<x[k];
}
if(x[k]>=10&&x[k]<=35){
x[k]+=55;
cout<<char(x[k]);
}
}
return 0;
}