题解 | 八进制
#include <bits/stdc++.h> using namespace std; int main(){ long long x; while(cin>>x){ string s=""; while(x!=0){ s.push_back(x%8+'0'); x/=8; } reverse(s.begin(),s.end()); cout<<s<<endl; } }
简单进制转换
#include <bits/stdc++.h> using namespace std; int main(){ long long x; while(cin>>x){ string s=""; while(x!=0){ s.push_back(x%8+'0'); x/=8; } reverse(s.begin(),s.end()); cout<<s<<endl; } }
简单进制转换
相关推荐