Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
119292 陈星云 十进制转d进制 C++ 通过 100 0 MS 252 KB 451 2024-01-05 13:33:19

Tests(10/10):


#include<iostream> #include<cstdlib> using namespace std; int s[111111]; int n,d,top=-1; int Push(int x) { top++;s[top]=x; } int Pop(int x) { if(s[top]>9) cout<<char(s[top]+55); else cout<<s[top]; x=s[top];top--; } int main() { cin>>n>>d; int top=-1,i=-1; if(n==0) cout<<"0"; else { while(n!=0) { Push(n%d); n/=d;i++; } while(i!=-1) { int tmp=n%d; Pop(tmp); i--; } } return 0; }


测评信息: