eclipse没问题,leetcode 1不能通过,超出int最大值了,但是怎么转无符号?/*Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known a...
分类:
其他好文 时间:
2015-06-04 00:56:32
阅读次数:
161
/*Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit...
分类:
其他好文 时间:
2015-06-03 23:12:12
阅读次数:
173
常用的移位操作是> ,分别为左移和右移。我们在C语言中有算数移位和逻辑移位两种。算数移位:区分符号的移位 {C语言中直接是定义char m = 3}逻辑移位:不区分符号的移位 {C语言中用unsigned char m = 3}算数移位和逻辑移位有什么不同,举例说明,例如:(1)对无符号数3...
分类:
其他好文 时间:
2015-06-03 15:40:01
阅读次数:
226
C中的格式字符有d,o,x,u,c,s,f,e,g等,之前有看到其中某些可以大写(待确定)。? 如: %d整型输出,%ld长整型输出, %o以八进制数形式输出整数, %x以十六进制数形式输出整数, %u以十进制数输出unsigned型数...
分类:
其他好文 时间:
2015-06-03 08:30:15
阅读次数:
168
ioctl控制设备除了读写设备之外,其他功能的实现需要ioctl。如串口的波特率的设定。用户空间:ioctl的应用apiint ioctl(int fd, unsigned long cmd, ...)fd 文件描述符cmd 发送的命令...依赖cmd命令内核空间api int (*ioctl)(....
分类:
其他好文 时间:
2015-06-03 00:53:58
阅读次数:
151
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).
For example, the 32-bit integer ’11' has binary representation 00000000...
分类:
其他好文 时间:
2015-06-02 22:04:54
阅读次数:
128
Reverse bits of a given 32 bits unsigned integer.
For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as0011100101...
分类:
其他好文 时间:
2015-06-02 22:04:40
阅读次数:
166
#define switch_to(prev,next,last) do { \ unsigned long esi,edi; \ asm volatile("pushfl\n\t" \ "pushl %%ebp\n\t" \ ...
分类:
系统相关 时间:
2015-06-02 17:21:36
阅读次数:
231
题目大意:求(1^K + 2^K + 3K + … + N^K) % 2^32解题思路:
借用别人的图
可以先打表,求出Cnm,用杨辉三角可以快速得到#include
typedef unsigned long long ll;
const int N = 55;
const ll mod = (1LL << 32);
struct Matrix{
ll mat[N][N...
分类:
其他好文 时间:
2015-06-02 15:20:40
阅读次数:
124