文章

10

粉丝

9

获赞

0

访问

3.3k

头像
八进制 题解:
P1417 华中科技大学机试题
发布于2024年7月20日 20:34
阅读数 348

#include<bits/stdc++.h>
using namespace std;

void f(int x){
    char y[66] = {0};
    int i = 0;
    
    while(x){
        y[i++] = x % 8 + '0';
        x = x / 8;
    }
    
    for (int j = i - 1; j >= 0; j--) {
        printf("%c", y[j]);
    }
    printf("\n");
}


int main(){
    int x;
    while(scanf("%d", &x) != EOF){
        f(x);
    }
    return 0;
}

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发