20
查看原帖
20
1368822
Sx0528楼主2024/8/31 11:52
#include<bits/stdc++.h>
using namespace std;
string a;
int main()
{
	long long n,x;
	cin>>n>>x;
	if(n==0)
	{
		cout<<n<<endl;
		return 0;
	}
	int y,s;
	while(y!=0)
	{
		y=n/x;
		s=n%x;
		char d;
		if(s<10) d=s+48;
		else d=s+55;
		a+=d;
		n=y;
	}
	for(int i=a.size()-1;i>=0;i--)
	{
		cout<<a[i];
	}
	return 0;
}

2024/8/31 11:52
加载中...