
CSUST_ACM_05
文章平均质量分 65
CSUST_ACM
这个作者很懒,什么都没留下…
展开
-
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 · 600 阅读 · 0 评论 -
C - Colorful Rainbows 解题报告 (双向栈)
先将所给直线按b值排序,b值小的直线若想最后在上面,就必须比当前最小的斜率小,或者比最大的斜率大所以最小斜率和最大斜率弄2个栈,我是弄一个数组,把起点放在中间如果斜率满足,就看他是否覆盖了之前的线,类似于凸包中的退栈方法#include #include #include #include using namespace std;struct deng{ double x原创 2012-09-15 17:18:30 · 1857 阅读 · 0 评论 -
线段树专题: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 · 1843 阅读 · 0 评论 -
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 · 1695 阅读 · 0 评论 -
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 · 1975 阅读 · 0 评论 -
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 · 2008 阅读 · 0 评论 -
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 · 2046 阅读 · 0 评论 -
线段树与树状数组模版及专题练习
专题练习: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 · 1947 阅读 · 0 评论 -
HDU 1540 Tunnel Warfare(平衡树) 解题报告
一道看似线段树的题,用平衡树也破了。。。。/* * 题意:有N个村庄,相邻点相连,可以毁坏某个点或修复毁坏点,求某点的最大联通点数。 * 方法:平衡树。 * 分析:最最朴素的想法就是把破坏的村庄做一个标记,然后遇到Q的时候,就循环的找一 * 下答案,当然这么做肯定是会超时的设想一下,如果能够很快的找到距离某个点最近的 * 两个被破坏掉的点,那么答案就很容易得到了于是用到了原创 2012-09-20 20:15:55 · 2053 阅读 · 0 评论 -
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 · 2028 阅读 · 0 评论 -
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 · 2439 阅读 · 0 评论 -
线段树专题: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 · 1601 阅读 · 0 评论 -
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 · 2530 阅读 · 0 评论 -
ChangChun_1011 USACO ORZ (HDU 4277)
有是平衡树,表示比赛那天敲出三进制代码了,就是查找时没有用平衡树,TLE了。。这下知道平衡树的好了。 #include #include #include #include /* 给出n条边,每条边有一定的长度,现在要用所有的边围成三角形,问能够围成多少个不 * 同的三角形(三边至少有一边不等)。 * * 分析: * 对三角形进行编号,A,B,C三边,所有的原创 2012-09-12 19:55:45 · 460 阅读 · 0 评论 -
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 · 643 阅读 · 0 评论 -
字符串专题: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 · 775 阅读 · 0 评论 -
字符串专题:H - Blue Jeans(暴力法)
/*大致题意:就是求k个的字符串的最长连续公共子串,规定:1、 最长公共串长度小于3不输出 2、 若出现等长的最长的子串,则输出字典序最小的串解题思路:纠结了几个月放着没做的题目。。一直以为要用KMP或者后缀数组来做。。。然后我就拼命学后缀。。。今天偶然发现直接 暴力 能够达到0ms的效果= =所以。。。暴力吧。。。不愧为初级的题。。。暴力思想很转载 2012-09-12 20:07:24 · 988 阅读 · 0 评论 -
POJ 1873 The Fortified Forest (计算几何,枚举+凸包)
看了很久了的题了,集训的时候就看过,每棵树有自己的价值和长度,现在要砍掉一些书做成栅栏,来围起剩余的树,并要使砍掉的树价值总和最小。当时觉得有价值,树也有砍与不砍2种状态,就觉得这是DP,然后在死胡同里绕啊绕~~后来才发现,树2要从数据量上推算法啊!//Memory: 216K //Time: 172MS #include #include #include #i原创 2012-09-12 20:15:29 · 812 阅读 · 0 评论 -
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 · 707 阅读 · 0 评论 -
字符串专题: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 · 1645 阅读 · 0 评论 -
字符串专题: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 · 1099 阅读 · 0 评论 -
字符串专题: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 · 682 阅读 · 0 评论 -
字符串专题: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 · 474 阅读 · 0 评论 -
简说期望类问题的解法
转自:http://kicd.blog.163.com/blog/static/126961911200910168335852/近年的acm竞赛中,数学期望问题常有涉及,在以前也常让本人感到很头疼,近来突然开窍,掌握了基本的分析方法,希望对大家有帮助。写得浅薄,可能数学上不够严谨,只供理解。 首先,来看下期望有啥基本的公式。对离散型随机变量x,其概率为p,有转载 2012-09-25 20:15:55 · 1966 阅读 · 0 评论