UVa 11556 - Best Compression Ever
来源:互联网 发布:炒股神器软件 编辑:程序博客网 时间:2024/05/29 16:30
题目:给你n个文件,问用b+1位2进制数能否进行编号(不包括全0的编号)。
分析:简单题。直接比较n与(1<<(b+1))-1即可。
说明:使用long long防止溢出。
#include <algorithm>#include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>#include <cmath>using namespace std;int main(){long long n,b,m;while (cin >> n >> b) {m = (1LL<<(b+1))-1LL;printf("%s\n", n <= m ? "yes" : "no");} return 0;}
0 0
- UVa 11556 - Best Compression Ever
- uva 11556 - Best Compression Ever(水题)
- toj3095 Best Compression Ever 不懂 求解释?
- Best Training Ever
- LightOj 1111 - Best Picnic Ever
- LightOJ - 1111 Best Picnic Ever
- 题目2 : Best Compression Algorithms
- [网易笔试]Best Compression Algorithms
- UVA 1351 - String Compression
- The 46 Best-ever Freeware Utilities
- The 46 Best-ever Freeware Utilities-some
- Oracle Buys Sun: The Best Deal Ever
- Top 20 Best Agile Development Books, Ever
- Light OJ 1111 Best Picnic Ever
- The 10 Best MVC Tips Ever
- LightOJ - 1111 Best Picnic Ever (搜索)
- LightOJ 1111 Best Picnic Ever 简单bfs
- The 18 best image file compression tools
- linux下C语言编程,include的默认搜索路径
- MFC获取窗口句柄号的六种方法
- 自己对Z-stack的架构一些理解(仅作学习笔记,有错误希望大家能指出来,初学Z-Stack菜鸟一只)
- HttpClient 教程 HttpClient Tutorial
- 学习ASP .NET MVC5官方教程总结(八)搜索查询
- UVa 11556 - Best Compression Ever
- 工作十年对做事和做人的经验总结
- Linux0.11内核中处理器的寄存器关系
- linux驱动之poll
- 变量,运算符(笔记)
- C++中虚函数工作原理和(虚)继承类的内存占用大小计算
- iOS 使用UITextField隐藏键盘
- JVM参数设置、分析
- RTOS for Intel MinnowBoard MAX