Bitset[HDU2051]
Bitset
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 10007 Accepted Submission(s): 7749
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
Author
8600 && xhd
Source
校庆杯Warm Up
Recommend
linle
除2倒取余数
#include<stdio.h>
int main()
{
int p[50],x,i;
while (scanf("%d",&x)!=EOF)
{
int cnt=0;
while (x)
{
p[cnt++]=x&1;
x>>=1;
}
for (i=cnt-1;i>=0;i--) printf("%d",p[i]);
printf("\n");
}
return 0;
}
Bitset[HDU2051]的更多相关文章
- 数据结构之(HDU2051 Bitset)
Problem Description Give you a number on base ten,you should output it on base two.(0 < n < 10 ...
- strtok源码 bitset 空间压缩
源代码里有一段: unsigned char map[32]; /* Clear control map */ for (count = 0; count < 32; count++) map[ ...
- DFS序+线段树+bitset CF 620E New Year Tree(圣诞树)
题目链接 题意: 一棵以1为根的树,树上每个节点有颜色标记(<=60),有两种操作: 1. 可以把某个节点的子树的节点(包括本身)都改成某种颜色 2. 查询某个节点的子树上(包括本身)有多少个不 ...
- 把《c++ primer》读薄(3-3 标准库bitset类型)
督促读书,总结精华,提炼笔记,抛砖引玉,有不合适的地方,欢迎留言指正. //开头 #include <bitset> using std::bitset; 问题1.标准库bitset类型( ...
- BitSet构造函数的两种特例
C++11之后,bitset的构造函数新加了两种形式: bitset<bits>::bitset (const string& str, string::size_type str ...
- Bitset<>用于unordered container时的默认hash函数
自从c++11起,bitset用于unordered container,将会提供默认的hash函数. 在gcc中,相关代码如下: // DR 1182. /// std::hash speciali ...
- hdu 4920 Matrix multiplication bitset优化常数
Matrix multiplication Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/ ...
- hdu 5506 GT and set dfs+bitset优化
GT and set Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Probl ...
- (DFS、bitset)AOJ-0525 Osenbei
题目地址 简要题意: 给出n行m列的0.1矩阵,每次操作可以将任意一行或一列反转,即这一行或一列中0变为1,1变为0.问通过任意多次这样的变换,最多可以使矩阵中有多少个1. 思路分析: 行数比较小,先 ...
随机推荐
- Coursera台大机器学习课程笔记15 -- Three Learning Principles
这节课是最后一节,讲的是做机器学习的三个原则. 第一个是Occan's razor,即越简单越好.接着解释了什么是简单的hypothesis,什么是简单的model.关于为什么越简单越好,林老师从大致 ...
- 数据库多张表导出到excel
数据库多张表导出到excel public static void export() throws Exception{ //声明需要导出的数据库 String dbName = "hdcl ...
- PHPNG (next generation)
PHPNG (next generation) This page gives short information about development state of a new PHP branc ...
- JavaScript 使用 sort() 方法从数值上对数组进行排序
使用 sort() 方法从数值上对数组进行排序. <html> <body> <script type="text/javascript"> f ...
- Longest Common Subsequence & Substring & prefix
Given two strings, find the longest common subsequence (LCS). Your code should return the length of ...
- 对Java中字符串的进一步理解
字符串在程序开发中无处不在,也是用户交互所涉及到最频繁的数据类型,那么字符串不仅仅就是我们简单的理解的String str = "abc";一起来更加深入的看一下 在Java中,字 ...
- Java for LeetCode 058 Length of Last Word
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the l ...
- HDU1003MAX SUM
Max Sum Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Sub ...
- sublime text 3 使用过程总结记录
自定义的设置: "save_on_focus_lost": true //在文件失去焦点的时候自动保存
- 运输装备(codevs 1669)
1669 运输装备 时间限制: 1 s 空间限制: 256000 KB 题目等级 : 钻石 Diamond 题解 题目描述 Description 德国放松对英国的进攻后,把矛头指向 ...