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 ...
随机推荐
- Python代码这样写更优雅(转)
1.变量交换 大部分编程语言中交换两个变量的值时,不得不引入一个临时变量: >>> a = 1>>> b = 2>>> tmp = a>&g ...
- [Leetcode Week15]Populating Next Right Pointers in Each Node
Populating Next Right Pointers in Each Node 题解 原创文章,拒绝转载 题目来源:https://leetcode.com/problems/populati ...
- C++之初始化问题
首先,我们应该明确的是在C++中初始化不是赋值,因为初始化是必要的,如果读取了未初始化的值将会导致不明确的行为.初始化指创建变量并且给它赋初值,而赋值则是擦除对象的当前值并用新值代替.C++支持两种初 ...
- 2017多校第6场 HDU 6096 String AC自动机
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6096 题意:给了一些模式串,然后再给出一些文本串的不想交的前后缀,问文本串在模式串的出现次数. 解法: ...
- C基础 常用设计模式粗解
引言 面向对象, 设计模式是现代软件开发基石. C的面向过程已经很简洁, 但不代表C就没有面向对象.(libuv框架中C面向对象用的很多) 因为思想是互通的.全当熟悉一下那些常用的设计模式.先假定有一 ...
- 使用XShell通过SSH访问Google谷歌云服务器方法
1:先用Xshell创建个密钥 下一步到这里,这个名称要记得,谷歌后台要用的. 把这里的公钥复制出来,当然最好也可以备份下. 2:到谷歌后台去添加ssh,然后就能连接了. 复制刚才生成的公钥,在谷歌云 ...
- 过渡&动画
进入/离开&列表过渡 概述 Vue在插入,更新或者移除Dom时,提供多种不同方式的应用过渡效果.包括以下工具 在css过渡和动画中自动应用class 可以配合使用第三方css动画库,如Anim ...
- python初学-列表
列表操作: 列表一般需要先调用方法后才能打印,不能直接打印调用的方法 因为列表可以修改 一般不会返回一个新列表 # 列表 # new_names = ['lzc','lzc2','lzc3'] # 下 ...
- AC日记——[SDOI2009]HH去散步 洛谷 P2151
[SDOI2009]HH去散步 思路: 矩阵快速幂递推(类似弗洛伊德): 给大佬跪烂-- 代码: #include <bits/stdc++.h> using namespace std; ...
- Ant Design React按需加载
Ant Design是阿里巴巴为React做出的组件库,有统一的样式及一致的用户体验 官网地址:https://ant.design 1.安装: npm install ant --save 2.引用 ...