Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|---|
142874 | 冼俊烨 | 十进制转d进制 | C++ | Accepted | 100 | 0 MS | 248 KB | 368 | 2024-04-10 13:51:33 |
# include <iostream> using namespace std ; char i2c ( int x ) { if ( x < 10 ) { return '0' + ( x - 0 ) ; } return 'A' + ( x - 10 ) ; } 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 ; }