1 #include2 #include 3 #include 4 #define _for(i,a,b) for(int i = (a);i < b;i ++) 5 typedef long long ll; 6 using namespace std; 7 int m,n; 8 inline ll read() 9 {10 ll ans = 0;11 char ch = getchar(), last = ' ';12 while(!isdigit(ch)) last = ch, ch = getchar();13 while(isdigit(ch)) ans = (ans << 1) + (ans << 3) + ch - '0', ch = getchar();14 if(last == '-') ans = -ans;15 return ans;16 }17 inline void write(ll x)18 {19 if(x < 0) x = -x, putchar('-');20 if(x >= 10) write(x / 10);21 putchar(x % 10 + '0');22 }23 char rnt[100];24 int rntend = 0;25 void f(int k,int r)26 {27 if(k==0) return ;28 int le = k%r;29 if(le<0) le-=r,k+=r;30 f(k/r,r);31 if(le>=10) rnt[rntend++] = 'A'+le-10;32 else rnt[rntend++] = le+'0';33 }34 int main()35 {36 m = read(),n = read();f(m,n);37 printf("%d=%s(base%d)\n",m,rnt,n);38 return 0;39 }