1027. Colors in Mars
来源:互联网 发布:java编程思想 豆瓣 编辑:程序博客网 时间:2024/06/16 22:30
题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1027
// 进制转换:大于10进制时,需要对字符特殊处理。// 本题中已经说明,结果为2位,所以直接倒序存储。// // 进制转换可以建立一个查询表:// char table={'0', '1', '2', '3' ...... ,'A', 'B', 'C'};#include <stdio.h>#include <string.h>char table={'0', '1', '2', '3' '4', '5', '6', '7', '8', '9','A', 'B', 'C'};void translate(int t, char a[]){memset(a, '0', sizeof(a));int i=1;while(t != 0){a[i--] = table[t%13];t /= 13;}a[2] = 0;return ;}int main(){#ifdef ONLINE_JUDGE#elsefreopen("E:\\in.txt", "r", stdin);#endifint t;int n=3;printf("#");while(n-->0){scanf("%d", &t);char a[5];translate(t, a);printf("%s", a);}printf("\n");return 0;}
0 0
- 1027. Colors in Mars
- 1027. Colors in Mars
- 1027. Colors in Mars
- 1027.Colors in Mars
- 1027. Colors in Mars
- 1027. Colors in Mars
- 1027. Colors in Mars
- 1027. Colors in Mars
- 1027. Colors in Mars
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 【Kettle从零开始】第十一弹之Kettle性能调优介绍
- Android 开发之使用Eclipse Debug调试详解
- apache 设置IP访问、配置apache虚拟域名、Apache 配置二级域名、php 配置 curl
- android 后台任务的最佳实现1——Service
- FileSystemWatcher判断文件复制完成
- 1027. Colors in Mars
- fzu 2124
- error:2014-03-11周二:在编写win32程序时依旧使用控制台程序。
- Android 游戏引擎
- android – 多屏幕适配相关
- poj 图论题目分类(转载)
- 1058. A+B in Hogwarts
- SUSE Linux 11里Nginx+Resin+JSP+Memcached+MySQL安装配置整合
- Android引入第三方jar包的方法