Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
147626 谢绍澜 十进制转R进制 C++ Accepted 1 MS 276 KB 617 2026-02-06 15:18:53

Tests(10/10):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<vector> #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int c(int x){ if(x>=10) return x+'A'-10; else return x+'0'; } int main(){ int x,r; cin>>x>>r; vector<char>a; if(x==0){ cout<<0; return 0; } while(x){ a.push_back(c(x%r)); x/=r; } for(int i=a.size()-1;i>=0;i--){ cout<<a[i]; } return 0; }