PAT_A1027
PAT甲级1027.
目录
A1027
题目
样例
输入:
15 43 71
输出:
#123456
思路和坑点
进制转换,而且只有两位数,直接使用/和%两个操作确定每一位的数值,可以直接建立每一位数值的映射表,或者直接用字符运算输出。
AC代码
#include<bits/stdc++.h>
using namespace std;
int main(void){
#ifdef ONLINE_JUDGE
#else
freopen("1.txt","r",stdin);
#endif
putchar('#');
for(int i=0;i<3;i++){
int temp;
scanf("%d",&temp);
char a,b;
a=temp/13>9?(temp/13-10+'A'):(temp/13+'0');
b=temp%13>9?(temp%13-10+'A'):(temp%13+'0');
putchar(a);putchar(b);
}
return 0;
}