随笔分类 -  数据结构 线段树

摘要:一道很水的题,我把它用线段树来写的,算是一看点吧#include<stdio.h>#define maxn 105double sum[maxn<<2];double max(double a,double b){ if(a>b) return a; else return b;}void btree(int l,int r,int rt){ if(l==r) { scanf("%lf",&sum[rt]); return; } int mid=(l+r)>>1; btree(l,mid... 阅读全文
posted @ 2012-09-24 20:10 M_cag 阅读(151) 评论(0) 推荐(0)
摘要:A Simple Problem with IntegersTime Limit: 5000MSMemory Limit: 131072KTotal Submissions: 36129Accepted: 10381Case Time Limit: 2000MSDescriptionYou have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a .. 阅读全文
posted @ 2012-09-14 20:40 M_cag 阅读(352) 评论(0) 推荐(0)
摘要:Just a HookTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9758Accepted Submission(s): 4776Problem 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 @ 2012-09-14 09:23 M_cag 阅读(756) 评论(0) 推荐(0)
摘要:BillboardTime Limit: 20000/8000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4947Accepted Submission(s): 2294Problem DescriptionAt the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the 阅读全文
posted @ 2012-09-04 21:43 M_cag 阅读(165) 评论(0) 推荐(0)
摘要:I Hate ItTime Limit: 9000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 18019Accepted Submission(s): 6947Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个 阅读全文
posted @ 2012-08-16 18:10 M_cag 阅读(206) 评论(0) 推荐(0)
摘要:敌兵布阵Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18917Accepted Submission(s): 8234Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数 阅读全文
posted @ 2012-08-16 15:41 M_cag 阅读(4259) 评论(0) 推荐(0)