![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
acm小技巧
文章平均质量分 61
小学生反弹
这个作者很懒,什么都没留下…
展开
-
poj 3061
先是看了一下讲解 ,选取 了二分法 ,由于数列都是正数的特殊情况,每一个sum【i】+s 对应一个最小的连续序列,最后只要减掉sum【i】就可以,lower_bound刚好可以用来查找最小的sum【i】+i,算法复杂度(nlogn),另外还有一种尺取法,复杂度只有n,大意是设置t,s两个节点,不断加减来更新res的最小值下面是ac过的法一代码**************************原创 2014-10-15 19:29:19 · 619 阅读 · 0 评论 -
poj 3061 尺取法
#include#include#include#include#include#include using namespace std;const int maxn=100010;int a[maxn];int sum[maxn];int times;int n,S;int res;/////////////////////*v原创 2014-10-15 20:18:55 · 337 阅读 · 0 评论 -
链表的基本操作
研究生复试要求掌握链表的基本操作,就写了些demo实现了一下。都是简单的操作,是做链表题的基础。#include#include#include#include using namespace std;typedef struct LNode{ int data; struct LNode *next;}LNode, *LinkList;int GetE原创 2016-03-23 17:38:42 · 385 阅读 · 0 评论 -
双亲表示(数组表示)的树的基本操作
//树的构建,遍历,计算节点数,计算叶子节点数的基本操作#include#include#include#include #include#include#includeusing namespace std;#define MAX_TREE_SIZE 100typedef struct { char data; int parent;}PTNode;typ原创 2016-03-24 18:25:17 · 487 阅读 · 0 评论