Bitset

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 14685    Accepted Submission(s):
11173

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
 
十进制转化为二进制  太水了
 
#include<stdio.h>
#include<math.h>
int main()
{
int n,j,sum;
while(scanf("%d",&n)!=EOF)
{
sum=0;j=0;
while(n!=0)
{
sum=sum+((n%2)*pow(10,j++));
n=n/2;
}
printf("%d\n",sum);
}
return 0;
}

  

 

hdoj 2051 Bitset的更多相关文章

  1. hdu 2051 Bitset (java)

    问题: 之前做过类似题,但这次仍然不能解决相关问题. 字符串倒过来输:StringBuffer str=new StringBuffer(s); s=str.reverse().toString() ...

  2. HDU 2051 Bitset

    http://acm.hdu.edu.cn/showproblem.php?pid=2051 Problem Description Give you a number on base ten,you ...

  3. 杭电oj2047-2049、2051-2053、2056、2058

    2047  阿牛的EOF牛肉串 #include<stdio.h> int main(){ int n,i; _int64 s[]; while(~scanf("%d" ...

  4. hdoj:2051

    #include <iostream> #include <string> #include <vector> #include <algorithm> ...

  5. 【HDOJ】5632 Rikka with Array

    1. 题目描述$A[i]$表示二级制表示的$i$的数字之和.求$1 \le i < j \le n$并且$A[i]>A[j]$的$(i,j)$的总对数. 2. 基本思路$n \le 10^ ...

  6. 【HDOJ】4418 Time travel

    1. 题目描述K沿着$0,1,2,\cdots,n-1,n-2,n-3,\cdots,1,$的循环节不断地访问$[0, n-1]$个时光结点.某时刻,时光机故障,这导致K必须持续访问时间结点.故障发生 ...

  7. 【HDOJ】4305 Lightning

    1. 题目描述当一个结点lightning后,可以向其周围距离小于等于R的结点传播lightning.然后以该结点为中心继续传播.以此类推,问最终形成的树形结构有多少个. 2. 基本思路生成树级数模板 ...

  8. 【HDOJ】2242 考研路茫茫——空调教室

    tarjan缩点,然后树形dp一下可解.重点是重边的处理. /* 2242 */ #include <iostream> #include <sstream> #include ...

  9. 【HDOJ】1648 Keywords

    PE的注意,如果没有满足条件的不输出空格.简单模拟,暴力解. /* */ #include <iostream> #include <sstream> #include < ...

随机推荐

  1. linux cd命令不带路径参数

    #切换到当前用户的主目录.若为root用户,则切换到/root,若普通用户,则切换到/home/username $ cd

  2. UR #13 Yist

    第一次打UR,打了一个半小时就弃疗了QAQ 这是我唯一一道考试的时候做出来的题目,其他两道连暴力都懒得写了 很容易发现对于每个要删除的点 我们找到左边第一个比他小的不用删除的点,右边第一个比他小的不用 ...

  3. UIBezierPath画圆弧的记录

    UIBezierPath通过 - (void)addArcWithCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)s ...

  4. Git教程之撤销修改(7)

    自然,你是不会犯错的.不过现在是凌晨两点,你正在赶一份工作报告,你在readme.txt中添加了一行:

  5. POJ2533——Longest Ordered Subsequence(简单的DP)

    Longest Ordered Subsequence DescriptionA numeric sequence of ai is ordered if a1 < a2 < ... &l ...

  6. http连接

    一.http over tcp over ip

  7. MCC(移动国家码)和 MNC(移动网络码)

    国际移动用户识别码(IMSI) international mobile subscriber identity 国际上为唯一识别一个移动用户所分配的号码.     从技术上讲,IMSI可以彻底解决国 ...

  8. ListView使用CursorAdapter增加和删除item

    @Override protected void onCreate(Bundle savedInstanceState) { // TODO 自动生成的方法存根 super.onCreate(save ...

  9. poj1823,3667

    又来练线段树了…… poj1823题意很简单(明显的数据结构题),区间修改和统计最长连续空区间: 有了poj3468的基础,区间修改不是什么问题了,重点是求最长连续空区间:(弱弱的我纠结了好久) 在每 ...

  10. 修改Android默认背光值

    /********************************************************************* * 修改Android默认背光值 * 说明: * 本文主要 ...