Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
118939 陈家宝 十进制转d进制 C++ 通过 100 0 MS 256 KB 350 2024-01-02 13:52:30

Tests(10/10):


#include<bits/stdc++.h> using namespace std; string s="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int main() { stack<char> b; int n,d; cin>>n>>d; if(n==0){ cout<<0; return 0; } while(n!=0){ if(n%d<10) b.push((n%d)+'0'); else b.push(s[n%d-10]); n/=d; } while(b.empty()!=1){ cout<<b.top(); b.pop(); } return 0; }


测评信息: