- 博客(24)
- 资源 (2)
- 收藏
- 关注
原创 poj1226 Substrings
写这道题时,是为了熟悉一下KMP算法……花了一整天找错。辛苦啊! 这是自己写的KMP算法 #include #include using namespace std; #define N 100 #define L 100 char s[N+10][L+10]; int n
2011-08-30 16:04:41 770
原创 poj3096 Surprising Strings
水题,枚举即可…… #include #include #include using namespace std; int main() { char ch[100]; int flag[1000]; while(scanf("%s", &ch) ==
2011-08-30 16:00:12 1087
原创 hdu3576 Elevators in Jiayuan Students' Apartment
这是一道DP问题,觉得挺有意思的,所以时隔数日又写了一遍…… #include #include using namespace std; int dp[20][20][20][20]; int a[20]; int main() { int f,i,j,k;
2011-08-30 15:58:11 972
原创 poj1161 The Suspects
并查集 #include using namespace std; #define N 30000 #define G 501 int p[N], group[N]; int main() { int n, g; while(scanf("%d %d",
2011-08-29 18:03:44 791
原创 hoj Job!Job!Job!
hehe... 这是一道很好的题目,以下给出两种解法——思想都是采用贪心, 不过采用的数据结构不同。 一、并查集 #include using namespace std; #define N 100000 struct Node {int t, v;} a[N]; in
2011-08-29 16:25:50 686
原创 hdu3489 Necklace
http://acm.hdu.edu.cn/showproblem.php?pid=3489 Necklace Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Othe
2011-08-28 20:02:11 929
原创 两圆求交点
/* 求圆(x1,y1,R)和圆(x2,y2,r)的交点 数组p存放圆心(1~n-1)和交点(n~),数组radius存放半径 count 用于记录交点数(包括圆心的数目) */ for(int i=0; i<n; i++) { // 初始化 double
2011-08-28 19:57:16 2830
原创 J Judge Segments
J Judge Segments 这道题目,一开始做的时候感觉题意都有点没懂,最后静下心来才把题意搞懂! 题意就是判断线段是否包含在给出的线段中,感觉很简单,直接做!提交之后就TLE,这才发现原来都没有分析时间复杂度就做了! 最后就从已知线段开始开始
2011-08-19 22:46:40 631
原创 H Hello Kiki
H Hello Kiki Description One day I was shopping in the supermarket.There was a cashier counting coins seriously when a little kid running
2011-08-19 22:27:39 1470
原创 G Greedy Tino
G Greedy Tino Description Tinowrote a long long story. BUT! in Chinese... SoI have to tell you the problem directly a
2011-08-19 22:20:51 1043
原创 E Elevators in Jiayuan Students' Apartment
E Elevators in Jiayuan Students' Apartment Description There are three elevators in the Building Bof Jiayuan Students' Apartment in BJTU
2011-08-19 21:52:23 801
原创 D Digit Size
Problem Description Digital LC-display is widely used in many different fields such as electronic calculator, electronic watch, digital i
2011-08-19 21:29:55 727
原创 B Buy Sticks
Problem Description Imyourgod need 3 kinds of sticks which havedifferent sizes: 20cm, 28cm and 32cm. However the shop only sell75-centimete
2011-08-19 21:03:27 732
原创 最小生成树
图论 /* 最小生成树算法 Prim算法 */ for(i=1; i<n; i++) { lowcost[i] = dist[0][i]; adjvex[i] = 0; } lowcost[0] = 0; for(i=1; i<n; i++) {
2011-08-18 09:57:41 506
原创 usaco Magic Squares
这道题目,以前写过类似的。所以这次看了题目后,还是有头绪的。 不过这道真的很麻烦啊! 用到了Hash + BFS 1、2、3、4、5、6、7、8不管将它们怎样变换,最多也就8! = 40320 种情况,所以可以使用BFS算法枚举下,打表即可。这是总的思想。 但1……8是字
2011-08-17 22:27:19 931
原创 usaco Spinning Wheels
这道题有点意思,不过比较简单。。 就直接贴代码了。 hehe.... /* ID: guo geer PROG: spin LANG: C++ */ #include using namespace std; int main() { ifs
2011-08-17 16:34:56 821
原创 usaco contact
hehe..... 第一遍看完题目时,完全没看明白什么意思,就直接看输入输出去了。猜到个大致意思了,然后才看题的。 懂了后,第一想法是觉得这题目很难,有点不太想做了,因为最近做USACO上的题目,基本每个都得花一两天。难受啊。。。 后来出去走走,回来一坐下,马上就有想法
2011-08-15 18:16:28 1823
原创 usaco Shaping Regions
有太多不知道,又常常焦急地想去知道,因为这份心情,所以我愿意将我会的与大家分享 ——这也是我创建这个博客的目的! 今天发现自己辛辛苦苦做出一个题目后,越来越懒得写说明了。 突然想起了自己当初创建这个博客时,是抱着份什么心情............ hehe! 这道真的很
2011-08-14 17:35:54 1021
原创 usaco humble Numbers
hehe...... 这道题目不得不说很经典!竟害我想了一下午! 这次不想写注释了,呵呵。。。 代码如下: /* ID: guo geer PROG: humble LANG: C++ */ #include #include using namespace s
2011-08-12 19:42:18 877
原创 usaco Score Inflation
/* ID: guo geer PROG: inflate LANG: C++ */ #include #include using namespace std; const int MAX = 10001; struct node { int p; int
2011-08-12 16:03:46 848
原创 usaco Agri-Net
呵呵。。。。 这道题算法其实是典型的最小生成树算法,但还是用了不少时间,主要是这个输入让人很纠结啊! /* ID: guo geer PROG: agrinet LANG: C++ */ #include #include #include using namespace
2011-08-12 14:40:54 627
原创 poj1102 LC-Display
呵呵。。。 这道题是一位队友向我推荐的,当时因为看英文题看得头都大了,本不想做A题了。但这道题只需看下输入输出就能明白题目大意, 太爽了! 咱就不喜欢他妈的一个题目页来长。 其实这道题就是考简单的输入输出问题。 代码如下: #include using names
2011-08-11 21:38:42 837
原创 hoj12008 Parenthesis
呵呵 。。。 这道题是2011年暑假培训时,跑出去打工回来后做的第一道题,纠结了许久,不过还是做出来了, 这道题目用的枚举的算法。题目式子中运算符只有加、乘、括号,所以括号两端可能出现的运算符的情况只有(3*3)种(不包括括号某一端为空的情况),如果为下面4种情况的话: (
2011-08-10 16:38:40 658
php and mysql web development 4th edition 源码下载
2012-05-10
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人