题意:

输入三个范围为0~168的整数,将它们从十三进制转化为十进制然后前缀#输出。

AAAAAccepted code:

 #define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
char ans[][];
int main(){
int a,b,c;
cin>>a>>b>>c;
int cnt=;
while(a){
int x=a%;
if(x==)
ans[][++cnt]='A';
else if(x==)
ans[][++cnt]='B';
else if(x==)
ans[][++cnt]='C';
else
ans[][++cnt]=x+'';
a/=;
}
if(cnt==)
ans[][]='',ans[][]='';
else if(cnt==)
ans[][]='';
cnt=;
while(b){
int x=b%;
if(x==)
ans[][++cnt]='A';
else if(x==)
ans[][++cnt]='B';
else if(x==)
ans[][++cnt]='C';
else
ans[][++cnt]=x+'';
b/=;
}
if(cnt==)
ans[][]='',ans[][]='';
else if(cnt==)
ans[][]='';
cnt=;
while(c){
int x=c%;
if(x==)
ans[][++cnt]='A';
else if(x==)
ans[][++cnt]='B';
else if(x==)
ans[][++cnt]='C';
else
ans[][++cnt]=x+'';
c/=;
}
if(cnt==)
ans[][]='',ans[][]='';
else if(cnt==)
ans[][]='';
cout<<"#"<<ans[][]<<ans[][]<<ans[][]<<ans[][]<<ans[][]<<ans[][];
return ;
}

【PAT甲级】1027 Colors in Mars (20 分)的更多相关文章

  1. PAT 甲级 1027 Colors in Mars (20 分)(简单,进制转换)

    1027 Colors in Mars (20 分)   People in Mars represent the colors in their computers in a similar way ...

  2. PAT Advanced 1027 Colors in Mars (20 分)

    People in Mars represent the colors in their computers in a similar way as the Earth people. That is ...

  3. PAT (Advanced Level) Practice 1027 Colors in Mars (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1027 Colors in Mars (20 分) 凌宸1642 题目描述: People in Mars represent the c ...

  4. PAT 甲级 1027 Colors in Mars (20 分)

    1027 Colors in Mars (20 分) People in Mars represent the colors in their computers in a similar way a ...

  5. PAT甲级——1027 Colors in Mars

    1027 Colors in Mars People in Mars represent the colors in their computers in a similar way as the E ...

  6. PAT (Advanced Level) Practice 1027 Colors in Mars (20 分)

    People in Mars represent the colors in their computers in a similar way as the Earth people. That is ...

  7. PAT 甲级 1027 Colors in Mars

    https://pintia.cn/problem-sets/994805342720868352/problems/994805470349344768 People in Mars represe ...

  8. 1027 Colors in Mars (20 分)

    People in Mars represent the colors in their computers in a similar way as the Earth people. That is ...

  9. PAT甲级:1152 Google Recruitment (20分)

    PAT甲级:1152 Google Recruitment (20分) 题干 In July 2004, Google posted on a giant billboard along Highwa ...

随机推荐

  1. 如何处理 Web 图片优化?

    未优化的图片是影响网站性能的主要因素之一,尤其会影响初次加载.取决于图像的分辨率和画质,图片可能占据整个网站流量的 70%. 生产环境出现未优化的图片并显著影响初次加载速度的现象还是挺常见的.缺乏经验 ...

  2. tarjan-无向图(求割点)

    一.基本概念 1.割点:无向连通图中,如果删除某点后,图变成不连通,则称改点为割点. 2.桥:无向连通图中,如果去掉某条边后,整张无向图会分成两部分(即整张图不连通),这样的一条边成为桥. 3.点双连 ...

  3. opencv python:直线检测 与 圆检测

    霍夫直线变换介绍 霍夫圆检测 现实中: example import cv2 as cv import numpy as np # 关于霍夫变换的相关知识可以看看这个博客:https://blog.c ...

  4. Java JDK 1.5 1.6 1.7 新特性整理

    Java JDK 1.5的新特性 1.泛型 List<String> strs = new ArrayList<String>();//给集合指定存入类型,上面这个集合在存入数 ...

  5. SSL握手两大加密算法 : RAS算法 和 DH算法解析

    写下此博客记录心得体会,如有不足之处请指正   先是手稿笔记 :  正文:   在Https协议中,Client端和Server端需要三个参数才能生成SessionKey来加密信息. 三个参数分别是 ...

  6. python学习之HTML

    1.HTML初知 <!DOCTYPE html> <html lang="en"> <head> html头 <meta charset= ...

  7. EasyUI中使用自定义的icon图标

    我们在web开发中为了界面的更加漂亮,我们可能会使用EasyUI框架来帮我们实现一些好看的效果,那么在框架里面提供了很多的样式和图标,但是有时候自带的图标已经满足不了我们啦,这时候我们应该往里面加入我 ...

  8. Shell编程WEB界面展示实践

    操作系统:win7 虚拟机:Virtual box with Ubuntu13.10 WEB服务器: Nginx WEB服务器发布目录:/usr/local/nginx/html/c 测试文件:lis ...

  9. python安装MySQLclient

    直接使用pip命令安装mysqlclient : pip3 install mysqlclient 如果windows安装不了MySQL-python mysqlclient 参考以下解决方案: 这个 ...

  10. js图片轮换播放器

    <!DOCTYPE html> <html> <head> <title></title> <meta charset="u ...