90分求条
查看原帖
90分求条
1121276
fuxueziyi楼主2025/1/14 13:31
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,x;
	stack<int> s;
	cin>>n>>x;
	if(n==0) cout<<0<<endl;
	while(n){
		s.push(n%x);
		n/=x;
	}
	while(s.size()){
		if(s.top()>10){
			cout<<(char)('A'+(int)s.top()-10);
			s.pop();
			continue;
		}
		cout<<s.top();
		s.pop();
	}
}
2025/1/14 13:31
加载中...