文章

17

粉丝

0

获赞

119

访问

4.6k

头像
数字转换为十六进制数 题解:
P5222 中国科学技术大学2022年机试题
发布于2025年2月27日 09:08
阅读数 293

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

int main(){
    int s;
    while(cin>>s){
        
        if(s==0){
        cout<<0;
        return 0;
        }
        
        string ans; //储存答案
        if(s<0) {
            unsigned int tmp;
            tmp=(unsigned int)(s);
            while(tmp!=0){
            int w = (tmp%16);
            if(w<10) ans+=w+'0';
            else ans+=(w-10)+'a&#...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发