| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 143118 | C班詹皓杰 | 十进制转d进制 | C++ | Accepted | 100 | 0 MS | 252 KB | 344 | 2024-04-12 22:38:57 |
#include<iostream> #include<stack> using namespace std; stack<char> s; char to(int x){ if(x>=0 && x<=9){ return char(x+'0'); }else{ return char('A'+(x-10)); } } int main(){ int n,d; cin>>n>>d; do{ s.push(to(n%d)); n /= d; }while(n > 0); while(!s.empty()){ cout<<s.top(); s.pop(); } return 0; }