题解 | #小乐乐与进制转换#
小乐乐与进制转换
https://www.nowcoder.com/practice/242eafef2a704c0ca130d563b7b3ee2d
#include <iostream> using namespace std; int main() { long int a; cin>>a; int b[100]={0}; int i=99; while (a!=0) { b[i]=a%6; a=a/6; i--; } bool foundNonZero = false; for (int j = 0; j <= 99; j++) { if (b[j] != 0) { foundNonZero = true; } if (foundNonZero) { cout << b[j]; } } }