Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
111288 李佳璟 十进制转R进制 C++ Accepted 1 MS 268 KB 352 2025-03-01 11:31:11

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int x,r; int a[32]; int main() { cin>>x; cin>>r; if(x == 0) { cout<<0; return 0; } int n=0; while(x!=0) { int yu=x%r; a[n]=yu; n++; x=x/r; } for(int i =n-1; i>=0; i--) { if(a[i]>9){ cout<<(char)(a[i]+55); } else{ cout<<a[i]; } } return 0; }