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 ...
随机推荐
- 2017-2018-1 20179205《Linux内核原理与设计》第五周作业
<Linux内核原理与设计>第五周作业 视频学习及操作分析 一.用户态.内核态和中断 内核态在CPU执行中对应高执行级别,执行级别为0级,具有特权指令,可以访问任意物理地址:用户态执行级别 ...
- python基础===抽象
懒惰即美德 斐波那契数列: >>> fibs = [0,1] >>> for i in range(8): fibs.append(fibs[-2]+fibs[-1 ...
- JSON对象与字符串之间的相互转换
<html> <head> <meta name="viewport" content="width=device-width" ...
- C#比较两个list集合,两集合同时存在或A集合存在B集合中无
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- BZOJ 4241: 历史研究——莫队 二叉堆
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=4241 题意:N个int范围内的数,M次询问一个区间最大的(数字*出现次数)(加权众数),可以 ...
- C基础 寻找随机函数的G点
引言 随机函数算法应该是计算机史上最重要的十大算法之一吧. 而C中使用的随机函数 #include <stdlib.h> _Check_return_ _ACRTIMP int __cde ...
- linux命令(2):grep命令
实例一: a.log文件内容如下: 从 a.log 文件中提取包含“WARNING”或”FATAL”,同时不包含“IGNOR”的行 grep -E 'WARNING|FATAL' a.log | gr ...
- (转载)IntelliJ IDEA 自动导入包 快捷方式
原文地址:IntelliJ IDEA 自动导入包 快捷方式 idea可以自动优化导入包,但是有多个同名的类调用不同的包,必须自己手动Alt+Enter设置 设置idea导入包 勾选标注 1 选项,In ...
- Markdown语法简编
[笔者按]Markdown语法的最大的特点在于原文语法少而简,内容纯文本化,且生成的版式简洁优雅.本文参考了一些网上的参考文字,经自行精简整理. 区块元素 段落和换行,标题,引用,列表,代码块,分隔线 ...
- AC日记——[LNOI2014]LCA bzoj 3626
3626 思路: 离线操作+树剖: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 100005 #defin ...