Hdu 2051解题报告
来源:互联网 发布:绘图软件下载中文版 编辑:程序博客网 时间:2024/06/14 06:42
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
123
Sample Output
11011
#include<iostream>using namespace std;char a[100];int Bin(int n){ int j = 1; while(n>=2) { a[j++] = n%2+'0'; n = n/2; } a[j] = n+'0'; return j;}int main(void){ int n; while(~scanf("%d",&n)) { int count = Bin(n); for(int i=count;i>0;--i) printf("%c",a[i]); printf("\n"); } return 0;}
0 0
- Hdu 2051解题报告
- HDU 3342 解题报告
- HDU 3336 解题报告
- HDU 3335 解题报告
- hdu 2516解题报告
- hdu 1004解题报告
- hdu 2139解题报告
- hdu 1019解题报告
- hdu 1064 解题报告
- HDU 1113 解题报告
- hdu 1068 解题报告
- HDU:2050解题报告
- hdu 4001解题报告
- hdu 1005解题报告
- HDU解题报告--1003
- HDU解题报告--1004
- HDU解题报告--1005
- HDU 1005 解题报告
- [leetcode] 1. Two Sum 解题报告
- hdu 1074(状态压缩dp)
- poj 2406 Power Strings KMP算法
- 5本最佳的Java面向对象理论和设计模式的书籍
- c++配置mysql,读取的基本api
- Hdu 2051解题报告
- MySQL 分区表原理及使用详解
- vmware安装无法打开内核设备 \\.\Global\vmx86: 系统找不到指定的文件
- solr查询如何支持多个fq
- Redis的使用
- 合唱队
- date 可格式化的日期控件
- MAC 修改XCode代码显示风格
- js中return false的妙用