SDAU 课程练习3 1015
2016-04-29 12:48
183 查看
Problem O
Time Limit : 1000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)
Total Submission(s) : 12 Accepted Submission(s) : 9
Problem Description
Give you a number on base ten,you should output it on base two.(0 < n < 1000)
Input
For each case there is a postive number n on base ten, end of file.
Output
For each case output a number on base two.
Sample Input
1
2
3
Sample Output
1
10
11
题目大意:
输出二进制.....
思路:
用的正常的方法。。
感想:
为什么这个也在动态规划中出现。。
AC代码:
#include <iostream> #include<stdio.h> #include<algorithm> #include<string.h> using namespace std; int main() { long long int a,T,n,m,i,j,temp,k,b; int arr[100005]; while(cin>>a) { i=0; while(a!=0) { arr[i]=a%2; a/=2; i++; } for(i--;i>=0;i--) cout<<arr[i]; cout<<endl; } return 0; }
相关文章推荐
- Linux系统的负载与CPU、内存、硬盘、用户数监控的shell脚本
- 学术研究的技巧Productivity tips, tricks and hacks for academics (2015 edition)
- 开始集成Spring session 到项目,使用分布式session管理
- 全面理解面向对象的 JavaScript
- ubuntu下python环境变量配置以及将模块放入正确位置
- SDAU 课程练习3 1014
- 评浪潮“活性”存储概念
- iOS开发——使用Navigation和TabBar构造App框架与界面栈的重构
- 蓝桥杯 算法训练 复数运算
- POJ Brackets (区间dp)
- bootstrap学习笔记(4)
- 用MXnet实战深度学习之二:Neural art
- Android Studio使用Lint进行代码检查
- 如何确定自己是否适合做程序员?
- 一个面向Scheme程序员的monad介绍
- count(distinct) 与group by 浅析
- 用MXnet实战深度学习之一:安装GPU版mxnet并跑一个MNIST手写数字识别 (zz)
- 数据结构与算法——有向无环图的拓扑排序C++实现
- android 图片选择器 photopicker
- Concurrent包中的线程池