摘要: 问题:已知数组 a[],元素个数为n,现在更改数组中某些元素的值,求更改后a数组中i到j区间内元素的和(10){ sum+=c[i]; i-=LowBit(i);}return sum;} 具体题目分析Poj2352是一道树状数组的入门题目,这道题的题意为我们省去了不少工作y坐标已经按升序,y相同时x按升序排列好了,是一道树状数组的裸题,直接用树状数组可得。源代码hi.baidu.c... 阅读全文
posted @ 2011-04-28 20:09 cchun 阅读(353) 评论(0) 推荐(0) 编辑
摘要: 纯粹的数学题,题目的意思是给你一组序列,让你能同时改变它的一个子序列,让其子序列的值增加1,或者减少1.思路的话,就是找其中的数学规律,给你的序列例如是:3,5,1,4,7。先求出其序列的正差和=5-3+7-4=5;所以可以用最小的5步消除其差距。至于为什么嘛?直接用笔思考一下就可以办到了,再者,其不同的结果数是序列的头尾的差值的绝对值加1,这里要注意,并不是序列其中的最大值与最小值的差值。因为好... 阅读全文
posted @ 2011-04-26 14:26 cchun 阅读(499) 评论(0) 推荐(0) 编辑
摘要: 下列语句部分是Mssql语句,不可以在access中使用。 SQL分类: DDL—数据定义语言(CREATE,ALTER,DROP,DECLARE) DML—数据操纵语言(SELECT,DELETE,UPDATE,INSERT) DCL—数据控制语言(GRANT,REVOKE,COMMIT,ROLLBACK) 首先,简要介绍基础语句: 1、说明:创建数据库CREATE DATAB... 阅读全文
posted @ 2011-04-25 23:19 cchun 阅读(585) 评论(0) 推荐(0) 编辑
摘要: 今天早上郁闷了,有种被骗的感觉,wa了N次,看了别人的解题报告才知道,输入有多组数据。what?输入有多组数据,题目有说明么?InputThe first line of the input file contains a number of stars N (1#include//#include#defineM33000#definelowbit(x)x&(-x)... 阅读全文
posted @ 2011-04-24 11:24 cchun 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 七种qsort排序方法一、对int类型数组排序intnum[100];Sample:intcmp(constvoid*a,constvoid*b){return*(int*)a-*(int*)b;}qsort(nu... 阅读全文
posted @ 2011-04-24 09:27 cchun 阅读(269) 评论(0) 推荐(0) 编辑
摘要: HD1715题目http://acm.hdu.edu.cn/showproblem.php?pid=1715;大的fibonacci,用数组模拟,其实也不难,可是要优化就没那么容易了。以前做过大数加法,这一次用的是int二维数组,没有用难缠的字符数组了(字符数组好计算数的长度)。。所以还是贴过来了,,呵呵。#includeusing namespace std;int fib[1000][100... 阅读全文
posted @ 2011-04-24 05:28 cchun 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 大数,水题来着,不过如果不够细心,非常容易出错,水题水题,如果不够细心,水题也能搞死你。自己写的,哎,水平确实还不好,当模板实在不行。留自己以后慢慢欣赏。#includeusing namespace std;int main(void){int n,i,j,k,carry,answer[50000];while(cin>>n){ memset(answer,0,sizeof(answer... 阅读全文
posted @ 2011-04-24 05:19 cchun 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 题目http://acm.hdu.edu.cn/showproblem.php?pid=1061;郁闷了半天,原先的wa代码为(第一次没头没脑地做,全乱了):#includeusing namespace std;int main(void){int n,a,rnum,b[10000],order;cin>>n;while(n--){ cin>>a; rnum=a; if(rnum... 阅读全文
posted @ 2011-04-23 21:29 cchun 阅读(184) 评论(0) 推荐(0) 编辑
摘要: HDU1016题目http://acm.hdu.edu.cn/showproblem.php?pid=1016;#include#includeusing namespace std;int n;int number[100],visited[100];bool isprime(int a){ int flag=0; for(int i=2;i>n) { cout#... 阅读全文
posted @ 2011-04-23 21:27 cchun 阅读(259) 评论(0) 推荐(0) 编辑
摘要: #include#includeusing namespace std;int main(void){ int stack[20],len,in[10],out[20],count[20]; int *pp=NULL,*p,top,*q,i,n; char strin[10],strout[10]; while(cin>>n) { cin>>strin... 阅读全文
posted @ 2011-04-23 21:23 cchun 阅读(212) 评论(0) 推荐(0) 编辑