HDUOJ 又一版A+B 题目1877

给大家推荐个靠谱的公众号程序员探索之路,大家一起加油

#include
#include
using namespace std;
int main()
{
  int m,k;
  long long n;
  stack num;
  while(scanf("%d",&m),m)
  {
   scanf("%lld %d",&n,&k);
   n=k+n;
   if(n==0) printf("0\n");//一定不要忘记这种情况
   else
   {
    while(n)
    {
     num.push(n%m);
     n=n/m;
    }
    while(!num.empty())
    {
     printf("%d",num.top());
     num.pop();
    }
    printf("\n");
    }
  }
  return 0;
}

 

 

 

你可能感兴趣的:(HDU,oj)