题目:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), retu...
分类:
其他好文 时间:
2015-07-30 00:18:26
阅读次数:
203
题意:一列经过1000000个站点的火车上最多同时乘坐 K 个人,有 Q 个乘客按照题目给出的顺序去买票,输出所有购票成功的乘客做法:RMQ线段树 + 区间更新 1 #include "bits/stdc++.h" 2 using namespace std; 3 #define lson l...
分类:
其他好文 时间:
2015-07-29 19:00:58
阅读次数:
95
01: ///
02: /// 使用字节数组中的值初始 ZipInteger 结构的新实例
03: /// 注意:本构造函数会破坏传入的 bits 参数的值。
04: ///
05: /// 顺序为 big-endian 的字节值的数组
06: public ZipInteger(byte[] bits)
07: {
08: if (bits == null) throw ...
分类:
编程语言 时间:
2015-07-29 10:21:38
阅读次数:
186
Number of 1 BitsWrite a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For exampl...
分类:
其他好文 时间:
2015-07-27 14:47:21
阅读次数:
98
//无脑爆居然能过!!!!!解:其实正解也是暴力,但是可以证明在n>6时答案一定为零。第一步:对于任意两个数他们的二进制数要么有一半+的位是相同的,要么有一半+的位是不同的,于是首先使用与运算和且运算一定能使一半以上的位数变成0。那么设第一步得到的数字为x,接下来我们对x与下一个数c做与运算,x上已...
分类:
其他好文 时间:
2015-07-26 20:52:39
阅读次数:
109
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print the sequence of ...
分类:
其他好文 时间:
2015-07-25 10:45:07
阅读次数:
114
题目链接:http://www.bnuoj.com/bnuoj/problem_show.php?pid=27865Bits EqualizerTime Limit:1000msMemory Limit:131072KBThis problem will be judged on UVA. Orig...
分类:
其他好文 时间:
2015-07-24 17:57:20
阅读次数:
103
参考:algorithm LRU, how many bits needed for implement this algorithm?问题:在cpu缓存中使用的LRU替换算法需要多少位呢?解决方法:
对于n路相连的缓存来说,LRU每个缓存块需要的位数为log2(n),那么每个set需要的位数就为n*log2(n)。(原文:Assuming you mean a 4-way set-associa...
分类:
编程语言 时间:
2015-07-23 17:57:11
阅读次数:
505
1. 概述
位图(bitmap)是一种非常常用的结构,在索引,数据压缩等方面有广泛应用。本文介绍了位图的实现方法及其应用场景。
2. 位图实现
(1)自己实现
在位图中,每个元素为“0”或“1”,表示其对应的元素不存在或者存在。
#define INT_BITS sizeof(int)
#define SHIFT 5 // 2^5=32
#define MASK...
分类:
编程语言 时间:
2015-07-23 15:38:16
阅读次数:
198
题目如下:
Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest proportional area is...
分类:
其他好文 时间:
2015-07-23 13:54:51
阅读次数:
96