#include <iostream>
#include <string>
using namespace std;

int main()
{
    int N,R;
    string a("0123456789ABCDEFG");
    while (cin >> N >> R)
    {
        string s="";
        bool flag = true;
        if (N<0)
        {
            flag = false;
            N = -N;
        }
            
        while (N > 0)
        {
            s = a[N%R] + s;
            N /= R;
        }
        if (!flag)
        {
            s = "-" + s;
        }
        cout << s << endl;
    }
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-02
  • 2021-06-06
  • 2022-02-20
  • 2022-12-23
猜你喜欢
  • 2021-08-13
  • 2022-12-23
  • 2022-03-09
  • 2022-12-23
  • 2019-06-20
  • 2021-10-07
  • 2021-10-08
相关资源
相似解决方案