水题

AC代码:

#include<iostream>
using namespace std;
int main()
{
int i,j,b[1000],k;
while(cin>>i>>j)
{
int a=0;
if(i<0)
{i=-i;
cout<<"-";}
while(i)
{
b[a]=i%j;
i=i/j;
a++;
}
for(k=a-1;k>=0;k--)
if(b[k]>9)
{
cout<<(char)('A'+b[k]-10);
}
else
cout<<b[k];
cout<<endl;
}
return 0;
}

hdu 2031的更多相关文章

  1. HDU 2031 进制转换(10进制转R进制)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2031 进制转换 Time Limit: 2000/1000 MS (Java/Others)    M ...

  2. hdu 2031 杨辉三角

    题意:显示杨辉三角形. 解法: 组合数学公式:combi(n,m)=combi(n-1,m-1)+combi(n-1,m); 至于为什么有这个公式呢?那就是高中数学的内容啦 1: #include&l ...

  3. hdu 2031 进制转换(栈思想的使用)

    进制转换 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submis ...

  4. 致初学者(二): HDU 2014~ 2032题解

    下面继续给出HDU 2014~2032的AC程序,供大家参考.2014~2032这19道题就被归结为“C语言程序设计练习(三) ”~“C语言程序设计练习(五) ”. HDU 2014:青年歌手大奖赛_ ...

  5. HDU——PKU题目分类

    HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...

  6. hdu 1716(dfs)

    题目链接 : http://acm.hdu.edu.cn/showproblem.php?pid=1716     排列2   Problem Description Ray又对数字的列产生了兴趣:现 ...

  7. [转] HDU 题目分类

    转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...

  8. HDU ACM 题目分类

    模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 104 ...

  9. hdu 1716 排列2(DFS搜索)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1716 排列2 Time Limit: 1000/1000 MS (Java/Others)    Me ...

随机推荐

  1. PHP Directory 函数

    PHP 5 Directory 函数 函数 描述 chdir() 改变当前的目录. chroot() 改变根目录. closedir() 关闭目录句柄. dir() 返回 Directory 类的实例 ...

  2. 使用shiro安全框架上传文件时用HttpSession获取ServletContext为null问题解决方法。

    <!--在shiroFilter 中加入一下配置--> <init-param> <param-name>targetFilterLifecycle</par ...

  3. DoingOrder.aspx.cs缓存的使用方法

    using System; using System.Web.UI; using System.Data; using System.Text; using BLL = SmartWaterSys.B ...

  4. canvas 绘制矩形

    XXX(x,y,width,height)   x矩形左上角x坐标                                   y矩形左上角y坐标                       ...

  5. PreparedStatement可以有效地防止sql被注入

    import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import jav ...

  6. 【学习笔记】【Foundation】字典

    字典NSDictionary: 用于保存具有映射关系的数据:key-value: 创建NSDictionary的常用方法: dictionary: dictionaryWithContentsOfFi ...

  7. yarn资源调度(网络搜集)

    本文转自:http://www.itweet.cn/2015/07/24/yarn-resources-manager-allocation/ Hadoop YARN同时支持内存和CPU两种资源的调度 ...

  8. Linux服务器间信任关系建立方法

    http://blog.csdn.net/jiangzeyun/article/details/42489359

  9. ural 1106 Two Teams

    http://acm.timus.ru/problem.aspx?space=1&num=1106 #include <cstdio> #include <cstring&g ...

  10. BZOJ 4407 于神之怒加强版

    http://www.lydsy.com/JudgeOnline/problem.php?id=4407 题意: 给下N,M,K.求 思路:  来自:http://blog.csdn.net/ws_y ...