Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
141558 | 黄恩宁 | 十进制转d进制 | C++ | 解答错误 | 50 | 0 MS | 248 KB | 325 | 2024-04-06 08:20:09 |
#include<iostream> #include<cstdio> #include<stack> using namespace std; stack<int> stk; int main() { int d; long long n; cin>>n>>d; while(n) { stk.push(n%d); n/=d; } while(!stk.empty()) { int x=stk.top(); stk.pop(); if(x>=10) cout<<(char)(x-'0'+'A'); else cout<<x; } return 0; }