大佬救命
查看原帖
大佬救命
583610
DrAlfred楼主2022/1/3 21:35
#include<bits/stdc++.h>
using namespace std;
int origion,len=0,aim;
stack<int>ans;
unsigned long long to_ten;
char c;
int main(int argc,const char *argv[]){
	scanf("%d",&origion);
	rewind(stdin);
	while((c=getchar())!='\n'){
		if('A'<=c&&c<='Z'){
			to_ten=to_ten*origion+int(c-'A'+10);
		}
		else if('0'<=c&&c<='9'){
			to_ten=to_ten*origion+int(c-'0');
		}
	}
	scanf("%d",&aim);
	while(to_ten>0){
		ans.push(to_ten%aim);
		to_ten/=aim;
	}
	while(!(ans.empty())){
		if(ans.top()>=10){
			putchar(ans.top()-10+'A');
		}
		else{
			putchar(ans.top()+'0');
		}
		ans.pop();
	}
	return 0;
}

记录 为什么不过

2022/1/3 21:35
加载中...