hdoj:2031

时间:2023-03-09 09:15:27
hdoj:2031
#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<)
{
flag = false;
N = -N;
} while (N > )
{
s = a[N%R] + s;
N /= R;
}
if (!flag)
{
s = "-" + s;
}
cout << s << endl;
}
}