提交时间:2023-12-30 08:13:04

运行 ID: 118345

# include <iostream> using namespace std ; char i2c ( int x ) { return '0' + ( x - 0 ) ; } int main ( ) { int a , b ; cin >> a >> b ; string s ; if ( a == 0 ) { s = "0" ; } while ( a != 0 ) { s = i2c ( a % b ) + s ; a -= a % b ; a /= b ; } cout << s << endl ; return 0 ; }