hdu2031
http://acm.hdu.edu.cn/showproblem.php?pid=2031
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<iostream>
using namespace std; int main()
{
//freopen("in.txt","r",stdin);
int n,r;
int a[];
while(~scanf("%d%d",&n,&r))
{
memset(a,,sizeof(a));
int fh=;
if(n<)
{
n=-n;
fh=;
}
int t=;
while()
{
a[t++]=n%r;
if(n/r==)
break;
n=n/r;
}
if(fh==)
printf("-");
for(int i=t-;i>=;i--)
{
if(a[i]<)
printf("%d",a[i]);
else
{
int q=a[i]+;
printf("%c",q);
}
}
printf("\n");
}
return ;
}
hdu2031的更多相关文章
- HDU2031 进制转换
#include <iostream> #include "string" #include "cstdio" #include "cst ...
- OJ题目分类
POJ题目分类 | POJ题目分类 | HDU题目分类 | ZOJ题目分类 | SOJ题目分类 | HOJ题目分类 | FOJ题目分类 | 模拟题: POJ1006 POJ1008 POJ1013 P ...
随机推荐
- JS基础:函数
函数声明和函数表达式 在 JS 中定义函数的方式有两种:一种是函数声明,一种是函数表达式. 例如: //函数声明 function fun() { ... } //函数表达式 var f = func ...
- [K/3Cloud] 单据转换插件执行顺序
1.下推事件及顺序 //初始化变量 OnInitVariable(InitVariableEventArgs e) //解析字段映射关系,并构建查询参数.这里可以加入你想要的额外的字段 OnQuery ...
- Search Insert Position(二分查找)
Given a sorted array and a target value, return the index if the target is found. If not, return the ...
- Servlet自动刷新页面
以下内容引用自http://wiki.jikexueyuan.com/project/servlet/auto-refresh.html: 假设一个Web页面,显示了现场比赛得分或股票市场状况或货币兑 ...
- 原则 principles
1.找到对的人来讨论问题. 2.把工作分配给对的人才能把事情做对. 3.
- 关于Java函数不支持参数默认值的讨论,最后一条亮了 2333
- Rust 1.7.0 macro宏的复用 #[macro_use]的使用方法
Rust 1.7.0 中的宏使用范围包含三种情况: 第一种情况是宏定义在当前文件里.这个文件可能是 crate 默认的 module,也可能是随意的 module 模块. 另外一种情况是宏定义在当前 ...
- Win10還原成最乾淨的狀態
系統不穩定時我們想到的第一個選擇就是重灌,如果你的作業系統是win10將會有另外一個新選擇,就是透過程式進行還原,讓你的電腦回到剛安裝時的清爽. 工具資訊 [軟體名稱]微軟 Refresh Windo ...
- PLU Decomposition
PLU分解的优点是,能够将Ax=b的矩阵,转换成Ly=b, Ux = y 的形式.当我们改变系数矩阵b时,此时因为矩阵L和U均是固定 的,所以总能高效的求出矩阵的解. // LU.cpp : Defi ...
- Codeforces 690 C3. Brain Network (hard) LCA
C3. Brain Network (hard) Breaking news from zombie neurology! It turns out that – contrary to prev ...