Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
141557 刘嘉柚 十进制转d进制 C++ 解答错误 70 0 MS 252 KB 384 2024-04-06 08:19:31

Tests(7/10):


#include<iostream> #include<stack> #include<cstdio> using namespace std; stack <int> stk; int main(){ int n,d; cin>>n>>d; if(n==0){ stk.push(0); } while(n>0){ int yushu=n%d; stk.push(yushu); n/=d; } while (!stk.empty()){ int TOP=stk.top(); if(TOP>=10){ cout<<(char)TOP-10+'A'; } else{ cout<<TOP; } stk.pop(); } return 0; }


测评信息: