- 博客(156)
- 收藏
- 关注
转载 CF 370
A:http://codeforces.com/problemset/problem/370/A 1 #include<stdio.h> 2 #include<string.h> 3 #include<cmath> 4 #include<algorithm> 5 using namespace std; 6 ...
2013-12-08 11:58:00
229
转载 Drainage Ditches(Dinic最大流)
http://poj.org/problem?id=1273用Dinic求最大流的模板题,注意会有重边。邻接矩阵建图 1 #include<stdio.h> 2 #include<string.h> 3 #include<queue> 4 #include<algorithm> 5 using names...
2013-12-07 14:52:00
187
转载 Super Phyllis(穷举+搜索)
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2723题意:给出一些字符串u,v,代表u->v,问有几条边是多余的,也就是说去掉那些边后,u仍能到达v。思路:穷举每条边,试着去掉该边,bfs搜索两个点是否仍然可达。 1 #include<stdio.h...
2013-12-02 15:09:00
122
转载 Rocky(dfs)
题目描述Sylvester Stallion is an old horse who likes nothing better than to wander around in the fields around his stable. Sylvester is a little single minded and will walk in a straight line unles...
2013-12-02 10:32:00
107
转载 Minimum Cost(最小费用最大流)
DescriptionDearboy, a goods victualer, now comes to a big problem, and he needs your help. In his sale area there are N shopkeepers (marked from 1 to N) which stocks goods from him.Dearboy has ...
2013-11-30 22:00:00
170
转载 Electrification Plan(最小生成树)
http://acm.sdut.edu.cn:8080/vjudge/contest/view.action?cid=50#problem/D最小生成树模板,注意的是这里有k个发电站,它们不再需要连接其他的发电站,所以任何两个发电站之间的权值是0; 1 #include<stdio.h> 2 #include<string.h> 3 con...
2013-11-30 17:29:00
105
转载 Is the Information Reliable?(差分约束)
DescriptionThe galaxy war between the Empire Draco and the Commonwealth of Zibu broke out 3 years ago. Draco established a line of defense called Grot. Grot is a straight line withNdefense ...
2013-11-29 21:48:00
56
转载 TC598 div2
题意:给一些物品item[],这些物品的重量在101至300之间,要将这些物品全部放进若干个bins中,已知bins盛的重量为300,可以将bins装满也可以不装满,问放这些物品最少需要几个bins.思路:当时把最关键的地方忽略了,就是物品的重量在101至300之间,这就说明每个bins至多放2个物品。然后从小到大排序,倒着贪心就可以了。 1 #include<...
2013-11-29 14:23:00
52
转载 King(差分约束)
http://poj.org/problem?id=1364题意真心看不大懂啊。。。现在假设有一个这样的序列,S={a1,a2,a3,a4...ai...at}其中ai=a*si,其实这句可以忽略不看现在给出一个不等式,使得ai+a(i+1)+a(i+2)+...+a(i+n)<ki或者是ai+a(i+1)+a(i+2)+...+a(i+n)>ki首先给出两个数分别代...
2013-11-26 20:02:00
87
转载 C - Point on Spira
Time Limit:2000MSMemory Limit:262144KB64bit IO Format:%I64d & %I64uSubmitStatusPracticeCodeForces 279ADescriptionValera the horse lives on a plane. The Cartesi...
2013-11-26 17:16:00
108
转载 Intervals(差分约束)
http://poj.org/problem?id=1201题意:给出N个整数区间[ai,bi],并且给出一个约束ci,( 1<= ci <= bi-ai+1),使得数组Z在区间[ai,bj]的个数>= ci个,求出数组Z的最小长度。思路:建立差分约束系统。因为这里要求数组长度的最小值,要变为x-y>=k的标准形式。设数组 s[j] 表示数组 Z 区...
2013-11-24 19:31:00
193
转载 Books
DescriptionWhen Valera has got some free time, he goes to the library to read some books. Today he's gottfree minutes to read. That's why Valera tooknbooks in the library and for each b...
2013-11-23 21:24:00
88
转载 大数A-B
还没写过大数减法,今天比赛还WA了两次。。。 1 #include<iostream> 2 #include<string> 3 using namespace std; 4 5 void sub(string a, string b) 6 { 7 string tmp,ans = "",c = ""; 8 ...
2013-11-23 17:34:00
109
转载 Candies(差分约束)
http://poj.org/problem?id=3159题意:flymouse是幼稚园班上的班长,一天老师给小朋友们买了一堆的糖果,由flymouse来分发,在班上,flymouse和snoopy是死对头,两人势如水火,不能相容,因此fly希望自己分得的糖果数尽量多于snoopy,而对于其他小朋友而言,则只希望自己得到的糖果不少于班上某某其他人就行了。比如A小朋友强烈希望...
2013-11-22 22:01:00
104
转载 Constructing Roads(SPFA+邻接表)
题目描述 Long long ago, There was a country named X, the country has N citieswhich are numbered from 1 to N. The king of Country-X wants to construct some roads. Please note that Countr...
2013-11-22 18:55:00
184
转载 Coach(并查集)
DescriptionA programming coach hasnstudents to teach. We know thatnis divisible by3. Let's assume that all students are numbered from1ton, inclusive.Before the university programm...
2013-11-16 19:53:00
140
转载 Invitation Cards(邻接表+逆向建图+SPFA)
Time Limit:8000MSMemory Limit:262144KTotal Submissions:17538Accepted:5721DescriptionIn the age of television, not many people attend theater performances. ...
2013-11-12 21:56:00
143
转载 Rectangle and Square(判断正方形、矩形)
http://acm.sdut.edu.cn:8080/vjudge/contest/view.action?cid=42#problem/D改了N多次之后终于A了,一直在改判断正方形和矩形那,判断正方形时算出六条边再排序,若前四条边相等并且与后两条边满足勾股定理,说明是正方形,判断矩形时,我先对结构体二级排序,这样四个点有确定的顺序,再用点积判断是否有三个角是直角,是的话就是矩...
2013-11-10 20:38:00
796
转载 zoj 3088 Easter Holidays(最长路+最短路+打印路径)
Scandinavians often make vacation during the Easter holidays in the largest ski resort Are. Are provides fantastic ski conditions, many ski lifts and slopes of various difficulty profiles. Howeve...
2013-11-08 21:31:00
117
转载 AOE网上的关键路径(最长路径 + 打印路径)
题目描述 一个无环的有向图称为无环图(Directed Acyclic Graph),简称DAG图。 AOE(Activity On Edge)网:顾名思义,用边表示活动的网,当然它也是DAG。与AOV不同,活动都表示在了边上,如下图所示: 如上所示,共有11项活动(11条边),9个事件...
2013-11-08 17:27:00
1292
转载 Going Home(最小费用最大流)
Time Limit:1000MSMemory Limit:65536KTotal Submissions:16200Accepted:8283DescriptionOn a grid map there are n little men and n houses. In each unit time, ev...
2013-11-08 11:24:00
66
转载 Integer Intervals(贪心)
Time Limit:1000MSMemory Limit:10000KTotal Submissions:12123Accepted:5129DescriptionAn integer interval [a,b], a < b, is a set of all consecutive integer...
2013-11-06 20:40:00
157
转载 MPI Maelstrom(Dijkstra)
http://poj.org/problem?id=1502刷一道模板题稳定一下心情。。。Dijkstra求单源最短路,就是输入的时候注意下,是按下三角输入的(无向图),输入字符x表示i与j不通。可以这样输入:if(scanf("%d",&w)) map[i][j] = map[j][i] = w; else scanf("x");...
2013-11-06 19:41:00
63
转载 The Same Game(模拟)
http://poj.org/problem?id=1027题意:给一个10*15的地图,里面填充R,G,B三种颜色,每次找到当前地图的同色最大区域M,并将其删除,删除M后,上面的小球自然下落,当有空列时,空列右边的小球同时向左移动一列, 当最后地图上同色最大区域的小球个数是1或0时,循环结束;注意输出格式,最后输出一个空行。思路:while(true)...
2013-11-05 20:54:00
139
转载 France \'98(概率)
题目描述Today the first round of the Soccer World Championship in France is coming to an end. 16 countries are remaining now, among which the winner is determined by the following tournament: 1...
2013-11-03 21:32:00
200
转载 GCC
题目描述The GNU Compiler Collection (usually shortened to GCC) is a compiler system produced by theGNU Project supporting various programming languages. But it doesn’t contains the math operato...
2013-11-03 21:26:00
132
转载 吉哥系列故事――临时工计划(dp)
Time Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uSubmitStatusDescription 俗话说一分钱难倒英雄汉,高中几年下来,吉哥已经深深明白了这个道理,因此,新年开始存储一年的个人资金已经成了习惯,不过自从大学之后他不好意思再向大人要压...
2013-11-03 21:05:00
53
转载 Tribles(概率)
DescriptionProblemATribblesInput:Standard InputOutput:Standard OutputGRAVITATION,n."The tendency of all bodies to approach one another with a strengthproportion to ...
2013-11-03 19:29:00
270
转载 Flesch Reading Ease(模拟)
http://poj.org/problem?id=3371终于遇到简单一点的模拟题了。不过本人真心没有耐心读题目。。。它的大致意思就是给一段合法的文章,求出这段文章的单词数,句子数,音节数,按照题目给出的公式带入就出结果。>因为输入是按空格作为字符串结束标志的,因此每输入一个字符串就是一个单词,>句子结束的标志是 . ? : ; !五种,每输入一个字符串只须...
2013-10-30 20:19:00
285
转载 Instant Complexity(模拟,递归)
Time Limit:1000MSMemory Limit:10000KTotal Submissions:1535Accepted:529DescriptionAnalyzing the run-time complexity of algorithms is an important tool for d...
2013-10-29 21:39:00
72
转载 Lucky and Good Months by Gregorian Calendar(模拟)
http://poj.org/problem?id=3393好大的一道模拟题,直接当阅读理解看了。下面是大神写的题意,解释的好详细。定义:Goog month : 该月第一个工作日为星期一的月份Luckly month: 该月最后一个工作日为星期五的月份问: 给定一个Gregorian Calendar格里高公历的时间闭区间(就是包括端点的年月了)【开始年、月】...
2013-10-28 21:05:00
153
转载 Wall(Graham算法)
Time Limit:1000MSMemory Limit:10000KTotal Submissions:27110Accepted:9045DescriptionOnce upon a time there was a greedy King who ordered his chief Architect...
2013-10-26 16:18:00
106
转载 Beauty Contest(graham求凸包算法)
Time Limit:3000MSMemory Limit:65536KTotal Submissions:25256Accepted:7756DescriptionBessie, Farmer John's prize cow, has just won first place in a bovine be...
2013-10-25 20:53:00
100
转载 A Round Peg in a Ground Hole(判断是否是凸包,点是否在凸包内,圆与多边形的关系)...
Time Limit:1000MSMemory Limit:10000KTotal Submissions:4628Accepted:1434DescriptionThe DIY Furniture company specializes in assemble-it-yourself furniture k...
2013-10-25 17:35:00
222
转载 Pie(二分)
ime Limit:1000MSMemory Limit:65536KTotal Submissions:8930Accepted:3235Special JudgeDescriptionMy birthday is coming up and traditionally I'm serving p...
2013-10-24 19:19:00
122
转载 Expanding Rods(二分)
Time Limit:1000MSMemory Limit:30000KTotal Submissions:10287Accepted:2615DescriptionWhen a thin rod of length L is heated n degrees, it expands to a new len...
2013-10-24 17:52:00
77
转载 Fishnet(计算几何)
Time Limit:1000MSMemory Limit:10000KTotal Submissions:1642Accepted:1051DescriptionA fisherman named Etadokah awoke in a very small island. He could see cal...
2013-10-24 16:33:00
212
转载 Building a Space Station(kruskal,说好的数论呢)
Time Limit:1000MSMemory Limit:30000KTotal Submissions:3820Accepted:1950DescriptionYou are a member of the space station engineering team, and are assigned ...
2013-10-23 00:03:00
52
转载 n数码问题, 全排列哈希
转载了一篇关于全排列的哈希函数,Poj1077就是应用了全排列的哈希;我们经常使用的数的进制为“常数进制”,即始终逢p进1。例如,p进制数K可表示为K = a0*p^0 + a1*p^1 + a2*p^2 + ... + an*p^n (其中0 <= ai <= p-1),它可以表示任何一个自然数。对于这种常数进制表示法,以及各种进制之间的转换大家...
2013-10-22 20:38:00
111
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人