Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
141606 | 刘嘉乐 | 十进制转d进制 | C++ | 通过 | 100 | 0 MS | 252 KB | 317 | 2024-04-06 08:49:17 |
#include<bits/stdc++.h> using namespace std; char a[1000005]; int tot = 0; int main(){ int n,d; cin>>n>>d; a[0] = '0'; string s = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; while(n){ a[++tot] = s[n%d]; n/=d; } int i = tot; do{ cout<<a[i]; i--; }while(i>=1); cout<<'\n'; return 0; }