#include<iostream> #include<stack> using namespace std; int main(){ int n,m; stack<char> st; while(cin>>n>>m){ int temp; if((n<0&&m>0)||(n>0&&m<0)) cout<<"-"; while(n){ temp=n%m; temp=temp>0?temp:-temp; if(temp>=10) st.push(temp-10+'A'); else st.push(temp+'0'); n/=m; } while(!st.empty()){ cout<<st.top(); st.pop(); } cout<<endl; } return 0; }
杭电 hdu 2031
原创
©著作权归作者所有:来自51CTO博客作者冷面寒枪的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:杭电 hdu 2022
下一篇:杭电 hdu 3782
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章