POJ 3252 Round Numbers
| Time Limit: 2000MS | Memory Limit: 65536K | |
| Total Submissions: 7607 | Accepted: 2615 |
Description
The cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone' (also known as 'Rock, Paper, Scissors', 'Ro, Sham, Bo', and a host of other names) in order to make arbitrary decisions such as who gets to be milked first. They can't even flip a coin because it's so hard to toss using hooves.
They have thus resorted to "round number" matching. The first cow picks an integer less than two billion. The second cow does the same. If the numbers are both "round numbers", the first cow wins,
otherwise the second cow wins.
A positive integer N is said to be a "round number" if the binary representation of N has as many or more zeroes than it has ones. For example, the integer 9, when written in binary form, is 1001. 1001 has two zeroes and two ones; thus, 9 is a round number. The integer 26 is 11010 in binary; since it has two zeroes and three ones, it is not a round number.
Obviously, it takes cows a while to convert numbers to binary, so the winner takes a while to determine. Bessie wants to cheat and thinks she can do that if she knows how many "round numbers" are in a given range.
Help her by writing a program that tells how many round numbers appear in the inclusive range given by the input (1 ≤ Start < Finish ≤ 2,000,000,000).
Input
Output
Sample Input
2 12
Sample Output
6
Source
|
#include <iostream>
#include <cstdio> #include <cstring> using namespace std; int c[35][35],bit[35]; void Init() int calu(int x) int main() |
* This source code was highlighted by YcdoiT. ( style: Codeblocks )
POJ 3252 Round Numbers的更多相关文章
- POJ 3252 Round Numbers(组合)
题目链接:http://poj.org/problem?id=3252 题意: 一个数的二进制表示中0的个数大于等于1的个数则称作Round Numbers.求区间[L,R]内的 Round Numb ...
- [ACM] POJ 3252 Round Numbers (的范围内的二元0数大于或等于1数的数目,组合)
Round Numbers Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 8590 Accepted: 3003 Des ...
- poj 3252 Round Numbers(数位dp 处理前导零)
Description The cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, P ...
- POJ 3252 Round Numbers 数学题解
Description The cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, P ...
- POJ 3252 Round Numbers 组合数学
Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 13381 Accepted: 5208 Description The ...
- POJ 3252 Round Numbers(组合数学)
Round Numbers Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10223 Accepted: 3726 De ...
- POJ 3252 Round Numbers(数位dp&记忆化搜索)
题目链接:[kuangbin带你飞]专题十五 数位DP E - Round Numbers 题意 给定区间.求转化为二进制后当中0比1多或相等的数字的个数. 思路 将数字转化为二进制进行数位dp,由于 ...
- POJ - 3252 - Round Numbers(数位DP)
链接: https://vjudge.net/problem/POJ-3252 题意: The cows, as you know, have no fingers or thumbs and thu ...
- poj 3252 Round Numbers 【推导·排列组合】
以sample为例子 [2,12]区间的RoundNumbers(简称RN)个数:Rn[2,12]=Rn[0,12]-Rn[0,1] 即:Rn[start,finish]=Rn[0,finish]-R ...
随机推荐
- MVC项目经验杂谈
ASP.NET MVC 绝大多数的公司已经用上了ASP.NET MVC,博主手里也做了不少个MVC的项目,在这里分享一下我在项目中是如何使用MVC的 打造通用的异常处理 项目上线运行,并不是所有的时候 ...
- HDU 1213 How Many Tables(并查集)
传送门 Description Today is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Igna ...
- CF 468A 24 Game
题目链接: 传送门 24 Game time limit per test:1 second memory limit per test:256 megabytes Description L ...
- 我的WCF Data Service 系列 (一、为什么要有WCF Data Service)
开篇先说两名题外话, 在博问上,经常看到有个问性能问题,比如Entity Framework的性能行不行啊之类的. 其实这个行不行,关键还是看对象,一夜家族的老七可能勉强吃点蓝片片,也就行了,可真要让 ...
- 捉襟见肘之NSMutableSet和NSPointerArray
用来学习复习记录,其他优秀的译文,点击这里 一.NSMutableSet NSMutableSet和NSMutableArray存放数据方式分别是无序和有序,这说明,数组是可以通过index获取对象. ...
- C++ STL中vector的内存机制和性能分析
vecotr是动态数组,顾名思义他可以动态的增加自己的长度. 内存机制: 但是怎样的增加自己的长度? vector有两个函数一个是capacity()返回内存空间即缓冲区的大小,另一个是size()返 ...
- IPsec 学习笔记
工作中需要,参考网上的资料对IPSecVPN进行学习,并通过博客记录下一些知识点作为学习记录和后续复习的材料. Transport Layer (TLS) 其中主要参考了以下文档: http://ww ...
- mybatis 传递参数的方法总结
有三种mybatis传递参数的方式: 第一种 mybatis传入参数是有序号的,可以直接用序号取得参数 User selectUser(String name,String area); 可以在xml ...
- (总结)Nginx配置文件nginx.conf中文详解
#定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为等于CPU总核心数. worker_processes 8; #全局错误日志定义类型,[ debug | ...
- C#MVC路由配置 之 动态请求伪装静态Json来欺骗CND
public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.Ignore ...