题意:

输入三个范围为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. .net core 删除主表,同时删除子表

    前提条件: 代码懒加载, 数据库有外键关联 var entity = context.主表.Include(o => o.子表).FirstOrDefault(p => p.Id == i ...

  2. 蓝桥杯2016年省赛C/C++大学A组

    网友年龄 某君新认识一网友. 当问及年龄时,他的网友说: "我的年龄是个2位数,我比儿子大27岁, 如果把我的年龄的两位数字交换位置,刚好就是我儿子的年龄" 请你计算:网友的年龄一 ...

  3. bm坏字符 , Horspool算法 以及Sunday算法的不同

    bm坏字符 , Horspool算法 以及Sunday算法的不同 一.bm中的坏字符规则思想 (1)模式串与主串从后向前匹配 (2)发现坏字符后,如果坏字符不存在于模式串中:将模式串的头字符与坏字符后 ...

  4. ubuntu14.04安装好Hadoo之后接着安装hbase和介绍常用命令

    1.解压 tar -zxvf hbase-1.0.0-bin.tar.gzsudo mv hbase-1.0.0 /opt/hbasecd /optsudo chmod -R 775 hbase 2. ...

  5. es 的搜索

    kibana语言查询 q指定查询语句 df默认字段,不指定时 sort排序/from和size用于分页 profile可以查看查询是如何倍执行的 查询title的值等于2012 的数据 GET /mo ...

  6. 吴裕雄 python 机器学习——模型选择参数优化暴力搜索寻优GridSearchCV模型

    import scipy from sklearn.datasets import load_digits from sklearn.metrics import classification_rep ...

  7. 【PAT甲级】1098 Insertion or Heap Sort (25 分)

    题意: 输入一个正整数N(<=100),接着输入两行N个数,表示原数组和经过一定次数排序后的数组.判断是经过插入排序还是堆排序并输出再次经过该排序后的数组(数据保证答案唯一). AAAAAcce ...

  8. 常用工具api等链接

    java技术驿站 http://cmsblogs.com/ WatchMen(守望者成才网) http://www.watchmen.cn/ JAVA知识分享 http://www.java1234. ...

  9. P1579

    AC: #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for(int i = a; i < b ...

  10. 在HTML中实现两个div并排显示

    在HTML中让两个div并排显示,通常情况下有三种实现方式,包括: (1)设置为行内样式,display:inline-block (2)设置float浮动 (3)设置position定位属性为abs ...