Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
162608 王丞杰 十进制转R进制 C++ Accepted 1 MS 276 KB 326 2026-10-17 17:59:54

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int n,r; stack<int>s; cin>>n>>r; if(n==0){ cout<<0<<endl; return 0; } while(n>0){ s.push(n%r); n=n/r; } while(!s.empty()){ int k=s.top(); s.pop(); if(k>9){ cout<<char(k+55); } else{ cout<<k; } } return 0; }