Question:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100)...
分类:
其他好文 时间:
2015-07-13 20:25:01
阅读次数:
93
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For example, the 32-bit in...
分类:
其他好文 时间:
2015-07-13 20:09:47
阅读次数:
119
题意:求某网格图生成树个数,对1e9取模
题解:题目是裸的Matrix-Tree定理,这不是我要说的重点,重点是对于这个取模的处理。
因为这不是个质数,所以不能直接乘逆元来当除法用,直接高斯消元肯定是不行的,需要一定实现的小技巧。
我们可以考虑gcd的实现过程,辗转相除直到一个为0。多么好的思路,对于这个问题我们也可以这样处理,每次减掉相应的倍数即可
下面是代码#include <bits/...
分类:
其他好文 时间:
2015-07-13 12:08:41
阅读次数:
115
The DS90CR287 transmitter converts 28 bits of LVCMOS/LVTTL data into four LVDS data streams。
下面是它的pin图:
RxOUTn对应的就是TxINn,TxCLK IN对应着RxCLK OUT
原理示意:
调试成功注意事项:
①PLL VCC去耦电容:...
分类:
其他好文 时间:
2015-07-11 10:37:22
阅读次数:
184
读取未初始化的值会导致不明确的行为。在某些平台上,仅仅只是读取未初始化的值,就可能让你的程序终止运行。更可能的情况是读入一些“半随机”bits,污染了正在进行读取动作的那个对象,最终导致不可预知的程序行为,以及许多令人不愉快的调试过程。对于内置类型的对象手动初始化对于内置类型以外的任何其他东西,.....
分类:
编程语言 时间:
2015-07-11 10:37:17
阅读次数:
120
这道题我是自己出的思路,一遍A的 ,0.000ms。 看网上的题解大多相仿,我就说说我的思路吧 。
假设字符串 a、b
我们只需要从前向后扫一遍就行了,遇到?跳过去,遇到a[i] = '0'&&a[i]!=b[i] ;那么就向后找一个a[j]=='1'&&a[i]!=b[j],也就是说先用交换这个技能比较省步骤 。如果没有可以交换的,再扫一遍找? 如果a[i]==? && b[i]==0 那...
分类:
其他好文 时间:
2015-07-07 22:54:03
阅读次数:
238
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 gray...
分类:
其他好文 时间:
2015-07-07 16:53:37
阅读次数:
108
kernel/smp.c/* An arch may set nr_cpu_ids earlier if needed, so this would be redundant */
void __init setup_nr_cpu_ids(void)
{
nr_cpu_ids = find_last_bit(cpumask_bits(cpu_possible_mask),NR_CPUS) +...
分类:
其他好文 时间:
2015-07-06 21:52:09
阅读次数:
395
看一下bits/stl_map和bits/stl_set可以看到map和set的定义如下:
84 template ,
85 typename _Alloc = std::allocator > >
86 class map
87 {
88 public:
89 typedef _Key ...
分类:
系统相关 时间:
2015-07-04 23:35:04
阅读次数:
290
DES 支持8位加密解密,3Des支持24位,Aes支持32位。3Des是Des算法做三次。位数的单位是字节byte,不是bits。
3Des是把24位分成3组,第一组八位用来加密,第二组8位用于解密,第三组8位用于加密,所以,如果秘钥为123456781234567812345678(3组1-8),则相当于做了一次12345678的Des加密。例如:第一次用12345678秘钥对123进行加密...
分类:
移动开发 时间:
2015-07-01 16:08:33
阅读次数:
607