Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
141614 | 沈子雯 | 十进制转d进制 | C++ | 通过 | 100 | 0 MS | 252 KB | 339 | 2024-04-06 09:03:31 |
#include<bits/stdc++.h> using namespace std; int n,k; stack <int> t; int main() { cin>>n>>k; if(n==0) { cout<<0; return 0; } while(n!=0) { t.push(n%k); n/=k; } while(!t.empty()) { int f=t.top(); t.pop(); if(f>9) { char c=f-10+'A'; cout<<c; } else cout<<f; } return 0; }