题解
2025-03-23 20:55:31
发布于:江苏
26阅读
0回复
0点赞
#include<iostream>
#include<cstring>
using namespace std;
const int N=114514;
int a[N],b,c[N],re;
string s;
void f(string s,int h[])
{
	h[0]=s.size();
	for(int i=1;i<=h[0];i++)
	{
		h[i]=s[h[0]-i]-'0';
	}
}
void tmd(int a[],int b,int c[])
{
	c[0]=a[0];
	int num;
	for(int i=c[0];i>=1;i--)
	{
		num=re*10+a[i];
		c[i]=num/b;
		re=num%b;
	}
	while(c[c[0]]==0 && c[0]>1)
	{
		c[0]--;
	}
}
void p(int h[])
{
	for(int i=h[0];i>=1;i--)
	{
		cout<<h[i];
	}
}
int main(){
	cin>>b;
	cin>>s;
    f(s,a);
	tmd(a,b,c);
	cout<<re;
}
这里空空如也






有帮助,赞一个