#include<iostream>
#include<stack>
using namespace std;
long A,B,D,APB;
stack<long> myStack;
void transform()
{
if(APB==0)
{
cout<<0;
return;
}
while(APB!=0)
{
myStack.push(APB%D);
APB/=D;
}
while(!myStack.empty())
{
cout<<myStack.top();
myStack.pop();
}
}
int main()
{
cin>>A>>B>>D;
APB=A+B;
transform();
}
PAT1022D进制的A+B (20)
最新推荐文章于 2022-01-19 20:04:18 发布