Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
141593 秦炜杰 十进制转d进制 C++ 通过 100 0 MS 256 KB 355 2024-04-06 08:43:03

Tests(10/10):


#include<bits/stdc++.h> using namespace std; int main(){ stack<int> st; char c[30]; int n,m; cin>>n>>m; for(int i=0;i<26;i++) c[i]='A'+i; if(n==0){ cout<<"0"; return 0; } while(n!=0){ st.push(n%m); n/=m; } while(st.size()){ if(st.top()>=10) cout<<c[st.top()-10]; else cout<<st.top(); st.pop(); } return 0; }


测评信息: