1027.Colors in Mars
来源:互联网 发布:db2 查看数据库编码 编辑:程序博客网 时间:2024/06/16 21:37
【题意】
将三个十进制数转换为对应的13进制数
【思路】
直接码即可
#include <iostream>#include <string>using namespace std;string gao(string num){string ret;int tmp;tmp = 0;for(int i=0; i<num.length(); i++){tmp = tmp*10+num[i]-'0';}for(int i=0; i<2; i++){if(tmp%13>9){ret.insert(ret.begin(),tmp%13-10+'A');}else{ret.insert(ret.begin(),tmp%13+'0');}tmp /= 13;}return ret;}int main(int argc, char const *argv[]){string num;for(int i=0; i<3; i++){cin >> num;if(!i){cout << "#";}cout << gao(num);}system("pause");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)
- 鲜为人知的编程真相
- poj1637 Sightseeing tour (混合图欧拉回路)
- 《OC疯狂讲义》笔记(二)
- 1156. Binary tree 二叉树找根方法
- 具有返回值得函数遇到ruturn
- 1027.Colors in Mars
- CentOS 7 系统盘符挂载NTFS分区
- APP启动页,判断是否是第一次打开,带滑动页动画
- 1028.List Sorting
- Android Studio使用git(以oschina git为例)
- 《OC疯狂讲义》笔记(三)
- 腾讯,创新工场,淘宝面试题
- ENVI自带的非监督分类测试情况
- 关于Xcode6与Xcode5之间的细节差别(Precompile Prefix Header)