题解 | 八进制

八进制

https://www.nowcoder.com/practice/eda051c1effc4dffa630bc8507f0c5f7

#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n;
    while (cin >> n) { // 注意 while 处理多个 case
        vector<int>res;
        while(n){
            res.push_back(n%8);
            n/=8;
        }
        for(int i=res.size()-1;i>=0;i--){
            cout<<res[i];
        }
        puts("");
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

12-02 20:08
已编辑
门头沟学院 后端工程师
notbeentak...:孩子,说实话,选择很重要,可能你换一个方向会好很多,但是现在时间不太够了,除非准备春招
点赞 评论 收藏
分享
11-03 14:57
西北大学 营销
Belltrix:其实就是每根转动一定的角度
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务