自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

CSUST_ACM的专栏

长沙理工大学ACM

  • 博客(69)
  • 收藏
  • 关注

转载 简说期望类问题的解法

转自:http://kicd.blog.163.com/blog/static/126961911200910168335852/近年的acm竞赛中,数学期望问题常有涉及,在以前也常让本人感到很头疼,近来突然开窍,掌握了基本的分析方法,希望对大家有帮助。写得浅薄,可能数学上不够严谨,只供理解。           首先,来看下期望有啥基本的公式。对离散型随机变量x,其概率为p,有

2012-09-25 20:15:55 1856

原创 hdu 4419 Colourful Rectangle 杭州赛区 1010 (解题报告)

杭州赛区最后一题。。。。最近看线段树还是有收获的·~~~#include#include#include#include#define ls rt<<1#define rs rt<<1|1#define lson l,m,ls#define rson m+1,r,rs#define sf scanf #define pf printfusing

2012-09-25 20:11:40 1966

原创 hdu 4409 Family Name List 金华赛区1010 (解题报告)

金华赛区区域赛最后一题,比赛完后就马上给A了 = =! 哎~~~#include#include#include#includeusing namespace std;const int N = 30000 +5 ;//46MS 13568K 3213 B //字典树+模拟,这题真心无语了,比赛时就被题意坑了,在c询问的时候,我考虑了a是b的//父节点的情况

2012-09-25 17:55:34 2363

原创 HDU 1540 Tunnel Warfare(平衡树) 解题报告

一道看似线段树的题,用平衡树也破了。。。。/* * 题意:有N个村庄,相邻点相连,可以毁坏某个点或修复毁坏点,求某点的最大联通点数。 * 方法:平衡树。 * 分析:最最朴素的想法就是把破坏的村庄做一个标记,然后遇到Q的时候,就循环的找一 * 下答案,当然这么做肯定是会超时的设想一下,如果能够很快的找到距离某个点最近的 * 两个被破坏掉的点,那么答案就很容易得到了于是用到了

2012-09-20 20:15:55 1992

原创 线段树与树状数组模版及专题练习

专题练习:http://acm.hdu.edu.cn/webcontest/contest_show.php?cid=1441密码是: cugbacm  首先是准备工作,以下是常见的线段树初始定义:#include#includeusing namespace std;typedef __int64 lld;#define ls rt<<1#define

2012-09-17 19:17:18 1881

原创 poj2635The Embarrassed Cryptographer(数论)(解题报告)

http://poj.org/problem?id=2635Language:The Embarrassed CryptographerTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 10080Accepted: 26

2012-09-17 18:05:10 1783

原创 ZOJ 2971 Give Me the Number

题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2971ZOJ Problem Set - 2971Give Me the NumberTime Limit: 2 Seconds Memory Limit: 65536 KB Numbers in English are writ

2012-09-15 23:50:22 1603

原创 ZOJ 2966 Build The Electric System

题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2966Build The Electric SystemTime Limit: 2 Seconds Memory Limit: 65536 KB In last winter, there was a big snow storm i

2012-09-15 23:48:26 2316

原创 ZOJ 2965 Accurately Say "CocaCola"!

题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2965原题链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=29652012年9月15日组队赛Accurately Say "CocaCola"!Ti

2012-09-15 23:44:38 1732

原创 ZOJ 2969 Easy Task

题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2969ZOJ Problem Set - 2969Easy TaskTime Limit: 2 Seconds Memory Limit: 65536 KB Calculating the derivation of a poly

2012-09-15 23:26:02 2219

原创 ZOJ 2970 Faster, Higher, Stronger

题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2970Faster, Higher, StrongerTime Limit: 2 Seconds Memory Limit: 65536 KB In the year 2008, the 29th Olympic Games will

2012-09-15 23:23:19 1848

原创 线段树专题:poj 2464 Brownie Points II

非常金典的线段树题目~~~#include#include#include#define ls rt<<1#define rs rt<<1|1#define lson l,m,ls#define rson m+1,r,rs#define sf scanf #define pf printfusing namespace std;//非常经典的线段树题目,

2012-09-15 22:02:35 1801

原创 E - Easy Task 解题报告

水题,看懂题意可以,求求导后的每一项的系数#include int a[1000];int main(){ int cas,n,i; scanf("%d",&cas); while(cas--) { scanf("%d",&n); for(i=n;i>=0;i--) { scanf("%d",&a[i]); } for(i=n;i>=1;i--) {

2012-09-15 17:21:19 1972

原创 L - Light Bulbs 解题报告 (隐藏水题)

隐藏的大水题啊!!  the grid points.!!在网格点上面找。。坑爹。。模拟退火了好久直接枚举就好了#include #include #include #include using namespace std;struct deng{ double x,y,z,i;};deng d[105];double dis(int k,int b,in

2012-09-15 17:19:30 2453

原创 C - Colorful Rainbows 解题报告 (双向栈)

先将所给直线按b值排序,b值小的直线若想最后在上面,就必须比当前最小的斜率小,或者比最大的斜率大所以最小斜率和最大斜率弄2个栈,我是弄一个数组,把起点放在中间如果斜率满足,就看他是否覆盖了之前的线,类似于凸包中的退栈方法#include #include #include #include using namespace std;struct deng{ double x

2012-09-15 17:18:30 1815

原创 G - Give Me the Number 解题报告

G题,就是以前做过的字符串专题的差不多的题啊,就是多了个 “and ” 遇到 continue 即可。。。 #include#includechar text[35][20]={"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten",// 0 ~ 10 "elev

2012-09-15 16:50:03 1988

原创 J - Just Pour the Water 解题报告

本次比赛隐藏水题之一。。。估计这题看到 M 10^9 就跪了一半了吧。。。可是每个操作都是重复的,最多循环到一个程度,值就不会变了,所以用 a[], d[] 两个数组记录前后的两个状态,如果状态不在改变即可 break 了。。。#include#include#define esp 1e-5 #define sf scanfdouble a[25],c[25],d[2

2012-09-15 16:45:33 1931

原创 Hdu 1166 敌兵布阵 (树状数组版)

复习下树状数组:#include#include#define sf scanf#define pf printf //my 171ms AC//显然这道题目用树状数组比线段树简单的多,所以再写个树状数组复习下。 const int N=50000+10;int a[N],sum[N];void add(int i,int j){ while(i

2012-09-14 19:42:05 1636

原创 HDU 1018 Big Number数论(解题报告)

Problem DescriptionIn many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you ar

2012-09-14 19:13:19 1912

原创 线段树专题:hdu 1166敌兵布阵

线段树基础入门题,裸线段树什么的不解释。 //my 187ms AC//第一道自己A过去的线段树~ #include#include#include#define ls rt<<1#define rs rt<<1|1#define lson l,m,ls#define rson m+1,r,rs#define sf scanf #define pf

2012-09-14 18:16:38 1549

原创 HDU 1756 Cupid's Arrow 计算几何

题目:http://acm.hdu.edu.cn/showproblem.php?pid=1756   判断点是否在多边形内部   从点p做一条射线,看射线和多边形的交点有几个,奇数个为相交,偶数个不相交。。。#include#include#include#include#include#include#include#includeusing namespace

2012-09-12 23:39:18 1130

原创 POJ 1873 The Fortified Forest (计算几何,枚举+凸包)

看了很久了的题了,集训的时候就看过,每棵树有自己的价值和长度,现在要砍掉一些书做成栅栏,来围起剩余的树,并要使砍掉的树价值总和最小。当时觉得有价值,树也有砍与不砍2种状态,就觉得这是DP,然后在死胡同里绕啊绕~~后来才发现,树2要从数据量上推算法啊!//Memory: 216K //Time: 172MS #include #include #include #i

2012-09-12 20:15:29 738

原创 字符串专题:I - 统计难题(trie树 改良版)

#include#includechar s[12];//优化的字典树struct node{ int cnt; node *a[27]; node(){//初始化 cnt=0; memset(a,NULL,sizeof(a)); }}*h;void bd(node *root){ node *p=root; int i=0,id;

2012-09-12 20:08:18 439

转载 字符串专题:H - Blue Jeans(暴力法)

/*大致题意:就是求k个的字符串的最长连续公共子串,规定:1、 最长公共串长度小于3不输出 2、 若出现等长的最长的子串,则输出字典序最小的串解题思路:纠结了几个月放着没做的题目。。一直以为要用KMP或者后缀数组来做。。。然后我就拼命学后缀。。。今天偶然发现直接 暴力 能够达到0ms的效果= =所以。。。暴力吧。。。不愧为初级的题。。。暴力思想很

2012-09-12 20:07:24 931

转载 字符串专题:G - Milking Grid (二维kmp)

#include #include #define MAX 10010#define MIN 110//题意:给定一个n*m的字符矩阵,每行字符会有若干个相同的串组成,最后一个重复串不一定要完整。问这个矩阵可由面积最小为多少的矩阵组成。int len,next[MAX];int row[MAX],col[MIN];char str[MAX][MIN],rostr[M

2012-09-12 20:06:00 1037

原创 字符串专题:F - Oulipo (A包含多少次B?KMP)

#include#includechar a[1000000+5],b[10000+5];int next[10000+5],n,m;//题意:A串是否包含B串,包含多少次。//kmp完全匹配。。。注意next[i]=j中保存的是:b[]中以第i个数(b[i-1])结尾的前j个数(包括b[i-1])匹配b[]的前j个数。。//即 next[i]=j ->m b[i-j

2012-09-12 20:04:56 1601

原创 字符串专题:C - Inglish-Number (字符串操作基础题)

无脑流,模拟。。。#include#includechar text[35][20]={"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten",// 0 ~ 10 "eleven", "twelve", "thirteen", "fourteen", "fifteen

2012-09-12 20:03:42 730

转载 字符串专题:A - Keywords Search(AC自动机)

说说AC自动机:#include using namespace std; const int kind = 26; struct node{ node *fail; //失败指针 node *next[kind]; //Tire每个节点的26个子节点(最多26个字母) int count; //

2012-09-12 20:01:28 639

原创 ChangChun_1011 USACO ORZ (HDU 4277)

有是平衡树,表示比赛那天敲出三进制代码了,就是查找时没有用平衡树,TLE了。。这下知道平衡树的好了。 #include #include #include #include /* 给出n条边,每条边有一定的长度,现在要用所有的边围成三角形,问能够围成多少个不 * 同的三角形(三边至少有一边不等)。 * * 分析: * 对三角形进行编号,A,B,C三边,所有的

2012-09-12 19:55:45 420

原创 ChangChun_1001 A Simple Problem with Integers (HDU 4267)

解题报告什么的,都包含在Code里。。。#include#include#include#include#include#include#include#include#include#define eps 1e-7#define LL long long#define N 500005#define zero(a) fabs(a)<eps#

2012-09-12 19:53:20 567

原创 ChangChun_1002 Alice and Bob (HDU 4268)

#include#include#include#include#include#include#include#include#includeusing namespace std;#define pb push_back //强大的初始define; #define mp make_pair#define fi first#define

2012-09-12 19:51:18 612

原创 HDU 4287 Intelligent IME (水题瞎暴力)

http://acm.hdu.edu.cn/showproblem.php?pid=4287直接把字符串换成数字标记就可以了,只有6位数,果断暴力#include #include int shu[26]={2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,9};int s[1000000];int n,m;int num[5

2012-09-12 19:30:37 661

原创 HDU 1251 统计难题(解题报告)

Problem DescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).  Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分

2012-09-12 18:49:08 457

原创 POJ 3630 Phone List(解题报告)

DescriptionGiven a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let's say the phone catalogue listed these numbers:Emergency 911

2012-09-12 18:45:24 470

原创 POJ 2195 Going Home(解题报告)

DescriptionOn a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adjacent point. For each little ma

2012-09-12 18:40:47 520

原创 hdu 1527取石子游戏(威佐夫博奕)(解题报告)

http://acm.hdu.edu.cn/showproblem.php?pid=1527取石子游戏Problem Description有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假

2012-09-08 08:50:40 1164

原创 poj1469 COURSES(匈牙利算法)(解题报告)

链接:http://poj.org/problem?id=1469 COURSESDescriptionConsider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it i

2012-09-06 19:33:07 457

原创 poj 1142Smith Numbers(解题报告)

链接:http://poj.org/problem?id=1142 DescriptionWhile skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University,noticed that the telephone number of his brother-

2012-09-06 19:30:05 644

原创 URAL 1348(几何)(解题报告)

Goat in the Garden 2DescriptionA goat is tied to a peg (in a point C) in a garden with a strong rope of the length L (i.e. a goat may eat a grass that is not farther than Lmeters from the peg). Th

2012-09-06 19:25:57 455

原创 poj 2063 Investment(背包问题)(解题报告)

http://poj.org/problem?id=2063 InvestmentDescriptionJohn never knew he had a grand-uncle, until he received the notary's letter. He learned that his late grand-uncle had gathered a lot of money,

2012-09-06 19:21:00 630

空空如也

空空如也

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

TA关注的人

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