//(栈)poj3250将第i头牛能看到多少牛传化为第i头牛能被多少牛看见/*#include #include using namespace std;int main(){ unsigned long N,ans=0; stacks; scanf("%ld",&N); while(N--){ ....
分类:
其他好文 时间:
2015-04-20 00:11:16
阅读次数:
141
strrchr char?*ho_strrchr(const?char?*s,?int?c)?{
????const?char?*p;?
????unsigned?char?cc?=?c;
????for?(p?=?s;?*p;?p++);
????while?(s?<=?p)?{
????????...
分类:
其他好文 时间:
2015-04-19 13:19:11
阅读次数:
156
今天重新温习了一下C语言的指针部分,突然想到了经常会碰见的一种宏定义:#define PGAS (*((volatile unsinged long *)(x))) 在解析该宏定义前,先看看指针变量的声明 声明一个int类型的指针变量:int* p; 仅仅是这样定义,这个指针是不能够直...
分类:
其他好文 时间:
2015-04-19 00:59:09
阅读次数:
233
题目描述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 000000000...
分类:
其他好文 时间:
2015-04-18 22:02:38
阅读次数:
128
libevent源代码之最小堆的实现libevent 中通过结构体min_heap_t实现最小堆,该结构体的声明如下:typedef struct min_heap{ struct event** p; unsigned n, a;} min_heap_t;其中p是指向指针的指针,p指向了一个数组,...
分类:
其他好文 时间:
2015-04-18 17:28:50
阅读次数:
141
整数类型后面跟的是显示的宽度。M指示最大显示宽度。最大有效显示宽度是255。显示宽度与存储大小或类型包含的值的范围无关。实践出真知:mysql> create table test2 ( a int , b int(20) unsigned not null , c int(40) unsigned...
分类:
数据库 时间:
2015-04-18 12:57:36
阅读次数:
191
1. malloc()函数
1.1 malloc的全称是memory allocation,中文叫动态内存分配。
原型:extern void *malloc(unsigned int num_bytes);
说明:分配长度为num_bytes字节的内存块。如果分配成功则返回指向被分配内存的指针,分配失败返回空指针NULL。当内存不再使用时,应使用free()函数将内存块释放。
1....
分类:
其他好文 时间:
2015-04-17 18:24:20
阅读次数:
190
识别字符串中的整数并转换为数字形式
接口函数:
void take_num(const char *strIn, int *n, unsigned int *outArray)
【输入】 strIn: 输入的字符串
【输出】 n: 统计识别出来的整数个数outArray...
分类:
其他好文 时间:
2015-04-17 18:15:25
阅读次数:
170
写出来也被它的速度吓了一跳,程序最坑的地方应该就是防止溢出了。 #include <stdio.h>
#include <stdlib.h>
#define MOD (19999997)
struct matrix
{
unsigned long long a;
unsigned long long b; ...
分类:
其他好文 时间:
2015-04-17 14:07:53
阅读次数:
90
显然只有偶数长度的串符合题意,并且如果一个串符合题意,那么从其首尾各截掉一个字符也符合题意。于是枚举中心,二分可以向左右扩展的最远距离,累计答案。#include#include#includeusing namespace std;#define N 500001typedef unsigned ...
分类:
其他好文 时间:
2015-04-17 13:29:57
阅读次数:
109