Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
141562 刘嘉柚 十进制转d进制 C++ 通过 100 0 MS 248 KB 393 2024-04-06 08:22:53

Tests(10/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){ printf("%c",(char)(TOP-10+'A')); } else{ cout<<TOP; } stk.pop(); } return 0; }


测评信息: