← Back to List

11005번: 진법 변환 2 ↗

Solutions

C++14
240 B | 240 chars
#include <iostream>
using namespace std;
int A,B;
char a[]="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";

void f(int x)
{
	if(x>0)
	{
		f(x/B);
		cout<<a[x%B];
	}
	else {
    return;
  }
}
int main()
{
	cin>>A>>B;
	if(A==0) cout<<0;
	else f(A);
}