Problem E: 零起点学算法97——进制转换
#include<stdio.h>
int main(){
int n,r,a[];
while(scanf("%d%d",&n,&r)!=EOF){
int flag=,i=;
if(n<){
flag=;
n=-n;
} do{
a[i++]=n%r;
n=n/r;
}while(n); if(flag==)
printf("-");
while(i--){
if(a[i]>){
printf("%c",'A'+a[i]-);
}
else{
printf("%d",a[i]);
}
}
printf("\n");
}
return ;
}
Problem E: 零起点学算法97——进制转换的更多相关文章
- Problem X: 零起点学算法22——华氏摄氏温度转换
#include<stdio.h> int main() { float f,c; while(scanf("%f",&f)!=EOF) c=*(f-); pr ...
- 1190: 零起点学算法97——A == B ?(Java)
WUSTOJ 1190: 零起点学算法97--A == B ? Description Give you two integer numbers A and B, if A is equal to B ...
- Problem H: 零起点学算法109——单数变复数
#include <stdio.h> #include<string.h> int main(void) { int n; ]; scanf("%d",&a ...
- Problem G: 零起点学算法106——首字母变大写
#include<stdio.h> #include<string.h> int main(void) { ]; int i,k; while(gets(a)!=NULL) { ...
- Problem D: 零起点学算法95——弓型矩阵
#include<stdio.h> #include<string.h> int main() { ][]; while(scanf("%d%d",& ...
- Problem F: 零起点学算法42——多组测试数据输出II
#include<stdio.h> int main() { ; while(scanf("%d%d%d",&a,&b,&c)!=EOF) { ...
- Problem E: 零起点学算法34——3n+1问题
#include<stdio.h> #include<math.h> int main() { int n; n<=pow(,); ; scanf("%d&qu ...
- Problem K: 零起点学算法107——统计元音
#include<stdio.h> int main() { int n; ]; while(scanf("%d%*c",&n)!=EOF) { while(n ...
- Problem J: 零起点学算法105——C语言合法标识符
#include<stdio.h> #include<ctype.h>//调用isalpha函数 int main() { int n; ]; while(scanf(&quo ...
随机推荐
- 我的spring boot,杨帆、起航!
快速新建一个spring boot工程可以去http://start.spring.io/这个网址,配置完后会自动下载一个工程的压缩包,解压后导入相关ide工具即可使用. 工程中会自带一个class启 ...
- LCD实验学习笔记(六):存储控制器
s3c2440可使用地址空间为1GB(0x00000000到0x40000000). 1G空间分为8个BANK,每个BANK为128MB. 设27条地址线,和8个片选引脚(nGCS0-nGCS7). ...
- linux 服务简介
Linux服务(Linux services)对于每个应用Linux的用户来说都很重要.关闭不需要的服务,可以让Linux运行的更高效,但并不是所有的Linux服务都可以关闭.今天安装了一次CentO ...
- C++学习之路(二):引用
(1)引用是变量的别名 引用的基本定义格式:类型 &引用名 = 变量名 例如:int a = 1; int &b = a,这里b是a的别名,b与a都指向了同一块内存单元. 对于引用而言 ...
- tenda t402 家庭版 有线路由器
使用快速向导: adsl(拨号)+用户名+密码 路由器后DMZ主机设置简单图解:http://wenku.baidu.com/view/94b9f0768e9951e79b8927ce.html 可 ...
- MVC自定义路由实现URL重写,SEO优化
//App_Start-RouteConfig.cs public class RouteConfig { public static void RegisterRoutes(RouteCollect ...
- 关于c++的string的operator =
在 c++ primer 5 中在说到string的章节里面有这样一句话: string s5 = "hiya"; // copy initialization 也就是说,这里说上 ...
- iOS APP程序启动原理
UIApplication 程序启动原理 一个应用程序运行就必须要有一个进程,一个进程至少要有一个线程,我们把这个线程叫做主线程,主线程开启之后会开启一个主运行循环,如果不开启一个运行循环,程序开启了 ...
- KettleDB连接jdbc连接池参数介绍
http://sheng8407-sina-com.iteye.com/blog/1163245 http://blog.csdn.net/dingxingmei/article/details/41 ...
- Winfrom窗体间传值
1.通过tag属性传输,tag属性是存储与空间密切相关的数据.比如登陆界面的数据传输给主界面. 子窗体 ...