文章

21

粉丝

0

获赞

6

访问

1.5k

头像
八进制 题解:
P1417 华中科技大学机试题
发布于2026年1月16日 20:39
阅读数 87

数字嘉陵变字符,字符数减零变数字 

 

#include <stdio.h>  
#include <string.h>  
#include<iostream>
using namespace std;  

int main() {  
    
    
    int n;
    int temp;
    while(cin>>n){
        char ans[200000];
        int k=0;
        temp=n;
        while(temp>0){
            ans[k++]=(temp%8)+'0';//数字嘉陵变字符,字符数减零变数字 
            temp=temp/8;
        }
        for(int i=k-1;i>=0;i--){
            cout<<ans[i];
        }
        cout<<endl;
    }
    return 0...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发