Being educated in Computer Science and Mathematics is not always easy. Especially not if you have “friends” who repeatedly insist on showing you their new “proofs” that P equals NP, that the Riemann
Hypothesis is true, and so on.
    One of your friends recently claims to have found a fantastic new compression algorithm. As an example of its amazing performance, your friend has told you that every file in your precious collection of random bit strings after compression would be at most b bits long! Naturally, you find this a bit hard to believe, so you want to determine whether it is even theoretically possible for this to be true.
    Your collection of random bit strings consists of N files, no two of which are identical, and each of which is exactly 1000 bits long.

Input
The input file contains several test cases, each of them as described below.
    The input consists of two integers N (1 ≤ N ≤ 10^15) and b (0 ≤ b ≤ 50), giving the number of files in your collection and the maximum number of bits a compressed file is allowed to have.
Output
For each test case, write to the output a line containing either “yes” if it is possible to compress all the N files in your collection into files of size at most b bits, or “no” otherwise.
Sample Input
13 3
1 0
31415926535897 40
Sample Output
yes
yes
no

问题链接:UVA11556 Best Compression Ever
问题简述:(略)
问题分析
    n个文件,用b+1位是否可以表示?(全0不能表示)。使用位运算实现。
程序说明:(略)
参考链接:(略)
题记:(略)

AC的C++语言程序如下:

/* UVA11556 Best Compression Ever */#include <bits/stdc++.h>using namespace std;typedef long long LL;int main()
{LL n;int bits;while(scanf("%lld%d", &n, &bits) != EOF)printf("%s\n", n <= (1LL << (bits + 1)) - 1 ? "yes" : "no");return 0;
}

UVA11556 Best Compression Ever【位运算】相关推荐

  1. python中不同进制的整数之间可以直接运算_Python 进制转换、位运算

    一.进制转换 编程用十进制,十进制转换为二进制.八进制.十六进制 In [135]: bin(23) Out[135]: '0b10111' In [136]: oct(23) Out[136]: ' ...

  2. python isodd()判断奇偶_位运算(1的个数;2.判断奇偶)

    1. 1的个数 int NumberOf1(intn){int count = 0;while(n) {++count; n=(n-1)&n; } } 同样一个问题,位运算可以提高程序的运行效 ...

  3. python 整数逆位运算_python训练营:注释、运算符、数据类型与位运算

    天学习的内容整理成脑图如下,其中带☆的是需要重点掌握的模糊知识点,需要加强训练和记忆. 二.具体学习内容 2.1 注释 2.1.1 多行注释 2.1.2 长字符串注释 2.2 运算符 2.2.1 算术 ...

  4. 洛谷P1896 [SCOI2005]互不侵犯 状压dp+位运算

    题目链接:https://www.luogu.org/problem/P1896 题意:n*n的格子填数,每个数填放位置的周围(8个)不能有其他的数 n<=9 ,矩形状压 f[i][j][s], ...

  5. mysql 使用位运算

    如果你不知道什么是位运算的话, 那么请你先去看看基础的C语言教程吧. 与运算 a & b  , 或运算 a | b ,  异或运算 a ^ b , 或者 你也可以将 与运算理解为 + 法  例 ...

  6. 位运算+取某一位+java_Java位运算小节

    2019新春支付宝红包技术大揭秘在线峰会将于03-07日开始,点击这里报名届时即可参与大牛互动. 位运算表达式由操作数和位运算符组成,实现对整数类型的二进制数进行位运算.位运算符可以分为逻辑运算符(包 ...

  7. 进制转换 位运算(包括补码、原码、反码、~0等一些零碎东西一次说清)

    我发现网上关于标题上的内容介绍的都很零碎,因此为了方便查找.也为了本人对这一部分的充分理解,就想着写一篇这样的博客(我分成了几个部分,以便查找): 一.进制转换 让我们先来看看各个进制的定义: 十进制 ...

  8. (转)C语言位运算详解

    地址:http://www.cnblogs.com/911/archive/2008/05/20/1203477.html C语言位运算详解 作者:911 说明:本文参考了http://www2.ts ...

  9. 技术图文:位运算技术在求解算法题中的应用

    背景 前段时间,在知识星球立了一个Flag,这是总结Leetcode刷题的第一篇图文. 在总结这篇图文的时候,顺便把遇到的坑写了两篇辅助的图文,大家可以参考一下: 有符号整型的数据范围为什么负数比正数 ...

最新文章

  1. 模拟进程管理小结,编码规范的重要性
  2. windows 下frp服务启动_内网穿透frp linux服务端搭建和windows客户端使用
  3. java客服系统_阿里Java内部资料:2020最全Java技术栈(架构篇+算法篇+大数据)
  4. R语言使用ggplot2包的快速可视化函数qplot绘制散点图(设置数据点的形状、大小)实战
  5. python 时间字符串
  6. 3.放弃CHAR吧,在铸成大错之前!
  7. 知识库 IIS6.0中Response 对象 错误 ASP 0251 : 80004005
  8. 输出 100 万字、维护 3 个GitHub 项目,技术大佬的 2019 太燃了……
  9. 修改了sql默认路径无法登录服务器,PostgreSQL错误'无法连接到服务器:没有这样的文件或目录'...
  10. 测试眉形的有哪个软件_这五款自动化软件测试工具,你最喜欢用哪个?
  11. 十个模块_专栏 | ABAQUS Part模块的十个小技巧
  12. c语言dp算法,C++动态规划dp算法题
  13. 推荐阅读20100708
  14. Spring MVC + freemarker实现半自动静态化
  15. MFC操作读取excel文件
  16. mysql数据库优化经验_MySQL数据库优化经验详谈
  17. 2 VUE.js 内部指令
  18. 计算机程序配置不正确 请联系我们,电脑应用程序配置不正确怎么办
  19. Android签名概述
  20. 单GPU每秒76帧,重叠对象也能完美分割,多模态Transformer用于视频分割效果惊艳...

热门文章

  1. Adobe AIR教程:面向iOS设备的原生扩展
  2. DXUT框架剖析(3)
  3. 电脑运行内存不足怎么办_win7内存不足怎么办?教你使用虚拟内存来增加win7系统的运行内存...
  4. MySql性能优化学习路线图
  5. 使用Navicat Premium 同步 测试数据库 与 正式数据库 数据
  6. C语言pop_back用法,【C语言】单链表的所有操作的实现(包括PopBack、PushBack、PopFront、PushFront、Insert)...
  7. CDH中impala 的查询返回部分结果。 已超出 199 流查询的时间序列流限制。
  8. HUE与Oozie的集成
  9. java 字符串递归_关于java:递归函数以通配符模式匹配字符串
  10. php $表达式,PHP表达式概念及实例详解