在看Linux内核的路由代码时,发现有如下的结构体定义: 1 struct fib_table
{ 2 unsigned char tb_id; 3 unsigned tb_stamp; 4 int (*tb_lookup)(struct
fib_table *tb, co...
分类:
其他好文 时间:
2014-05-13 22:32:41
阅读次数:
458
大致题意:给出一个整数n,(1 int n,flat;unsigned long long
b;void DFS(unsigned long long a,int step){ if(flat||step==19) { return ; }
if(a%n==0)...
分类:
其他好文 时间:
2014-05-13 19:59:23
阅读次数:
276
__attribute__((packed))的作用
在结构体变量的声明中,经常可以看到__attribute__((packed))修饰符。这是做什么用的呢?请看一下程序:
#define u8 unsigned char
#define u16 unsigned short
#define u32 unsigned int
int main()
{
struct {
...
分类:
其他好文 时间:
2014-05-13 06:19:18
阅读次数:
416
题目链接题意:给出一个以数组形式表示的数, 求该数加1后的结果,同样以数组形式返回。附上代码: 1
class Solution { 2 public: 3 vector plusOne(vector &digits) { 4 unsigned int
len = digit...
分类:
其他好文 时间:
2014-05-12 12:49:34
阅读次数:
268
题目:http://poj.org/problem?id=2480
首先要会欧拉函数:先贴欧拉函数的模板,来源于吉林大学的模板:
//欧拉函数PHI(n)表示的是比n小,并且与n互质的正整数的个数(包括1)。
unsigned euler(unsignedx)
{// 就是公式
unsigned i, res=x;
for(i = 2; i < (int)sqrt(x ...
分类:
其他好文 时间:
2014-05-12 07:14:06
阅读次数:
368
1.随机化的代码: #include #include
srand((unsigned)time(NULL)); m=rand()%(r-l+1)+l;2.maparr;//arr[key] =
value3.读入一整行字符串 getline(cin,s); cin.ignore();//忽视一行
分类:
其他好文 时间:
2014-05-10 05:08:20
阅读次数:
294
1 static const unsigned short crc16_table[256]= 2 {
3 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, 4 0xC601,
0x06C...
分类:
其他好文 时间:
2014-05-10 00:02:02
阅读次数:
382
//生日快乐歌#include "stdafx.h"#include void
main(void) { unsigned FREQUENCY[] = {392,392,440,392,523,494,
392,392,440,392,587,523, 392,392,784,659,52...
分类:
其他好文 时间:
2014-05-09 23:23:22
阅读次数:
423
一、sizeof sizeof(...)是运算符,在头文件中typedef为unsigned
int,其值在编译时即计算好了,参数可以是数组、指针、类型、对象、函数等。 它的功能是:获得保证能容纳实现所建立的最大对象的字节大小。
由于在编译时计算,因此sizeof不能用来返回动态分配的内存空间的大小...
分类:
其他好文 时间:
2014-05-09 16:11:21
阅读次数:
267
unsigned int 0~4294967295int
2147483648~2147483647unsigned long 0~4294967295long 2147483648~2147483647long
long的最大值:9223372036854775807long long的最小值:-...
分类:
其他好文 时间:
2014-05-09 15:34:30
阅读次数:
210