求助
查看原帖
求助
615297
frankfan7707楼主2022/4/18 18:22

测试样例都过了,但最后一个点过不了,求大佬看看哪里错了

#include<bits/stdc++.h>
using namespace std;
long long n,x,a[10000005],k;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>x;
	if(x<=0){
		cout<<0;
		return 0;
	}
	while(n>0){
		a[k++]=n%x;
		n/=x;
	}
	for(long long i=k-1;i>=0;i--){
		if(a[i]<10){
			cout<<a[i];
		}
		else{
			cout<<(char)(65-a[i]+10);
		}
	}
}
2022/4/18 18:22
加载中...