2011年8月15日

树状数组 求区间和

摘要: 1 #include <stdio.h> 2 #include <string.h> 3 int N,a[60000]; 4 int lowbit(int x) 5 { 6 7 return x&(-x); 8 } 9 void add(int i,int x)10 {11 while(i<=N)12 {13 a[i]+=x;14 i+=lowbit(i);15 }16 }17 int sum(int i)18 {19 int sum=0;20 while(i)21 {22 sum+=a[i];23 i-=lowbit(i);24 }25 return s 阅读全文

posted @ 2011-08-15 19:27 more think, more gains 阅读(232) 评论(0) 推荐(0) 编辑

just a hook hdu 1689线段树

摘要: Just a HookTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5529Accepted Submission(s): 2568Problem DescriptionIn the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecut 阅读全文

posted @ 2011-08-15 19:15 more think, more gains 阅读(268) 评论(0) 推荐(0) 编辑

i hate it hdu 1754 线段树

摘要: I Hate ItTime Limit: 9000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9748Accepted Submission(s): 3656Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个测 阅读全文

posted @ 2011-08-15 18:56 more think, more gains 阅读(139) 评论(0) 推荐(0) 编辑

导航