摘要:
/* * c.cpp * * Created on: 2013-10-7 * Author: wangzhu */#include#includeusing namespace std;#define NMAX 100010struct Node { //index:表示两个数直接的距离(-1:表示未开始,0:表示开始:> 0:表示有了距离 //val:记录最后一次的位置 //flag:不符合条件 (0:表示符合条件,1:表示不符合条件) int index, val, flag;} node[NMAX];int main() { freopen("d... 阅读全文
posted @ 2013-10-07 23:53
qingyezhu
阅读(248)
评论(0)
推荐(0)
摘要:
/* * c.cpp * * Created on: 2013-10-7 * Author: wangzhu */#include#includeusing namespace std;struct Node { int key; Node* next;};void addToTail(Node* root, int val) { Node* node = new Node; node->key = val; node->next = NULL; if (root->next == NULL) { root->next = node... 阅读全文
posted @ 2013-10-07 18:57
qingyezhu
阅读(185)
评论(0)
推荐(0)
摘要:
/* * a.cpp * * Created on: 2013-10-7 * Author: wangzhu */#include#includeusing namespace std;struct Node { int key; Node* next;};void addToHead(Node* root, int val) { Node* tempNode = root->next; Node* node = new Node; node->key = val; node->next = tempNode; root->next = n... 阅读全文
posted @ 2013-10-07 18:18
qingyezhu
阅读(143)
评论(0)
推荐(0)
摘要:
/* * c.cpp * * Created on: 2013-10-7 * Author: wangzhu */#include#include#includeusing namespace std;struct Node { int key; Node* next;};/** * 尾插法:超时 */void addToTail(Node* root, int value) { Node* node = new Node(); node->key = value; node->next = NULL; if (root->next == NUL... 阅读全文
posted @ 2013-10-07 18:03
qingyezhu
阅读(242)
评论(0)
推荐(0)
摘要:
/* * c.cpp * * Created on: 2013-10-7 * Author: wangzhu */#include#includeusing namespace std;#define NMAX 1000010int arr[NMAX];/** * 只需要从左下角或右上角开始查找,即可。 * 当是从右上角开始查找时, * 左上角(row = 0,column = columns - 1), * 1)若查找的值key大于当前的值arr[i],则说明key在此行以下,故有row++; * 2)若查找的值key小于当前的值arr[i],则说明key在此列的左边,故有col... 阅读全文
posted @ 2013-10-07 16:00
qingyezhu
阅读(169)
评论(0)
推荐(0)
摘要:
hdu 1754/* * c.cpp * * Created on: 2013-10-6 * Author: wangzhu */#include#includeusing namespace std;#define MAX -1struct Node { int left, right, max; Node *leftChild, *rightChild;} node[800010];int getMax(int a, int b) { return a > b ? a : b;}int pos;void build(Node *root, int left, ... 阅读全文
posted @ 2013-10-07 00:01
qingyezhu
阅读(195)
评论(0)
推荐(0)

浙公网安备 33010602011771号