python和c++都可以ac的写法
查看原帖
python和c++都可以ac的写法
1214745
lol999楼主2024/9/1 09:24
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b,d;
	string s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",res="";
	cin>>a>>b;
	while(a>0){
		d = a%b;
		res = s[d]+res;
		a/=b;
	}
	cout<<res;
	
	return 0;
} 

data = int(input())

base = int(input())

digits = "0123456789ABCDEFGHJKLMNOPQRSTUVWXYZ"

result = ''

while data>0:

    remainder = data % base
    
    result = digits[remainder]+result
    
    data//=base
    
print(result)


2024/9/1 09:24
加载中...