自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 资源 (1)
  • 收藏
  • 关注

原创 hdu 1506 栈

题目链接:点击打开链接 题目大意:同poj 2796; 题目总结:hdu又被lld坑了 #include #include #include #include __int64 num[100010]; __int64 sum[100010],maxn=-1,tmp; int right[100010],left[100010]; int main() { int n,

2013-10-30 15:17:19 657

原创 poj 2796 feel good(单调栈)

#include #include #include long long num[100010]; long long sum[100010],maxn=-1,tmp; int right[100010],left[100010]; int main() { int n,i,a,b; while(~scanf("%d",&n)) { sum[0]=0;

2013-10-30 15:03:36 721

原创 zoj 3686 (a simple tree problem)

题目链接:点击打开链接 题目大意:给一棵树,节点上只有0 1,初始为0,进行operate则将此节点为根节点的子树都变为与之相反的。询问某个节点的子树1的个数。 题目分析:一看就是线段数,但是区间怎么找?所以要经过处理。参考了大神的想法http://blog.csdn.net/lenleaves/article/details/8759598。

2013-10-26 09:47:33 709

原创 poj 3250 bad hair day

题目链接:点击打开链接 题目分析:好用的单调栈! 维持栈内严格递减的顺序,因为栈顶元素小于当前的一定是看不见当前的所以留在那里没有任何价值,弹出 题目拓展:点击打开链接 #include #include #include #include #include #include using namespace std; stackdata; int main() {

2013-10-22 20:25:23 660

原创 poj 1702(Eva's Balance)

题目链接:点击打开链接 题目大意:有些3的幂的重量的砝码,现在给定任意一质量的重物,现在要求怎么样放置才能平衡 题目分析:将重物转化为三进制(0,1,2),先要分成3的幂,所以见2 就要想办法变为1,见1如果有前面的进位,那么也要进行进位。                    最终得到的没有2的数则为右边的重量,左边的所需要的则是刚才调整时用到的重量 由于是自己做法,有点搓欢迎斧

2013-10-22 15:21:18 816

原创 zoj 3702 Gibonacci number

题目链接:点击打开链接 题目大意:在斐波那切数列的原始定义上多了,f[1]为不确定,求问给一个f【i】和i 求f【j】? 题目分析:初始想用打表的方式,结果没T却ML了= =,回头想想,这样一定是有规律的,所以分析如下      i:    0    1      2          3              4              5             6    

2013-10-20 11:31:22 866

原创 hdu 1754(I hate it) 线段树

题目链接:点击打开链接 题目分析:非常好的模板题,适合入门,操作包括,区间询问,区间更改。需要注意的是数组的大小 相关链接学习:点击打开链接 #include #include #include #include using namespace std; #define maxn 200005 #define inf int n,m,a,b,c=0; int MAX[maxn<<

2013-10-18 10:19:30 606

原创 poj 2406 power string(KMP)

题目链接:点击打开链接 题目分析:利用KMP进行分析,白书上的方法略有不同                    其实就是进行预处理,找到上一个与之匹配的 总结:数组开小了,出现re #include #include #include #include using namespace std; int n,m,f[1000005]; char s[1000005]; int ge

2013-10-07 13:06:36 684

原创 poj 3304 ( segments)

题目链接:点击打开链接 题目分析:所有线段投影在直线上至少有交点,                    反过来想,如果存在这样的直线,那么也一定存在另一条与之垂直的直线与所有的线段相交。                    枚举任意线段的2个点形成的直线,看是否能满足 题目反思:第一遍以为任意其中的2个线段投影在直线上能有交点即可。结果~ #include #in

2013-10-04 14:09:16 597

原创 poj 2398 toy storage

题目链接:点击打开链接 题目分析:poj 2398和poj 2318一致 #include #include #include #include #include using namespace std; struct point { int x,y; point(int a=0,int b=0) { x=a; y=b

2013-10-03 12:48:15 618

原创 poj 2318 Toys

题目链接:点击打开链接 题目大意:把玩具放在格子里面,看每个格里面有多少玩具 题目分析:基础入门题目,注意叉积和规范写法 自己写的代码,欢迎斧正 #include #include #include #include #include using namespace std; struct point{ int x,y; point(int a=0,int b=0)

2013-10-03 09:58:48 562

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除