- 博客(117)
- 资源 (1)
- 收藏
- 关注
原创 Regionals 2009 :: Asia - Hsinchu UVALIVE, 4527 Vaccination Centers - 搜索剪枝
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=350&page=show_problem&problem=2528题目大意:为了以防禽流感,国家要在村庄中建一些卫生站,村庄是编号从0到n-1,对于每个村庄i,要么直接在该村庄新建卫生站,要么
2015-08-10 01:17:09 596
原创 Regionals 2009 Asia - Hsinchu uvalive 4526 Inventory - dp
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=350&page=show_problem&problem=2527题目大意:有个工厂要生产一些产品,生产之前先要买一些原材料,但是每天材料的价格不一样,今天买的材料只能今天用或者明天用,每天必须完成每
2015-08-10 00:50:52 610
原创 Regionals 2009 Asia - Hsinchu UVALIVE, 4525 - Clues 搜索
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=350&page=show_problem&problem=2526题目大意:话说岛国有位博士,想要保护一个数据的安全,这个数是个质数,假设是k0。他的策略是这样的,首先他选择一个r,r>=1,和一个空集合C,
2015-08-10 00:30:25 663
原创 hdu 1010 Tempter of the Bone 回溯
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1010题意:有只可怜的小狗掉进了陷阱,陷阱有个出口,但只在t秒后开一次,之后就不开了,小狗每走过一个地方就不能再走这个地方了,问小狗能否出去。思路:看下题目范围,n,m均小于7,回溯,将所有情况全部走一遍,看是否有解。代码:#include #include #include #i
2015-07-26 14:30:58 459
原创 hdu 1009 FatMouse' Trade 贪心
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1009题意:有只肥老鼠想跟很多房间的猫哥哥换粮食,但是每个房间的猫收费标准不同,问可怜的小老鼠最后最多能换多少粮食。思路:按照性价比排序,贪心。代码:#include #include using namespace std;///////////////////////stru
2015-07-26 14:21:41 503
转载 最小生成树-Prim算法和Kruskal算法
原文链接:http://www.cnblogs.com/biyeymyhjob/archive/2012/07/30/2615542.htmlPrim算法1.概览普里姆算法(Prim算法),图论中的一种算法,可在加权连通图里搜索最小生成树。意即由此算法搜索到的边子集所构成的树中,不但包括了连通图里的所有顶点(英语:Vertex (graph theory)),且其所
2015-07-25 10:11:29 501
原创 poj 2236 Wireless Network 并查集
Wireless NetworkTime Limit: 10000MS Memory Limit: 65536KTotal Submissions: 18869 Accepted: 7938DescriptionAn earthquake takes place in Southeast Asia. The ACM (
2015-07-25 09:49:54 329
原创 poj 2492 A Bug's Life 带权并查集
A Bug's LifeTime Limit: 10000MS Memory Limit: 65536KTotal Submissions: 30837 Accepted: 10090DescriptionBackground Professor Hopper is researching the sexual b
2015-07-25 09:37:25 466
原创 poj 1182 食物链 并查集扩展--带权并查集
食物链Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 52210 Accepted: 15277Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动
2015-07-25 09:24:56 400
原创 sgu 174 Walls 并查集+hash
People of country T-land lived on the big plain many years ago. It is happened so that they started to quarrel, so they began to build walls to separate from each other. One day they realized that w
2015-07-25 09:03:51 435
原创 poj 1611 The Suspects 并查集
The SuspectsTime Limit: 1000MS Memory Limit: 20000KTotal Submissions: 26537 Accepted: 12972DescriptionSevere acute respiratory syndrome (SARS), an atypical pneu
2015-07-25 08:20:30 362
原创 poj 3026 Borg Maze 最小生成树
Borg MazeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9954 Accepted: 3341DescriptionThe Borg is an immensely powerful race of enhanced humanoids fr
2015-07-25 08:12:11 399
原创 uva 10034 Freckles 最小生成树
题目连接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=975最小生成树模板题。代码:#include #include #include #include using namespace std;#defi
2015-07-25 08:05:05 430
原创 poj 1258 Agri-Net 最小生成树
Agri-NetTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 44617 Accepted: 18242DescriptionFarmer John has been elected mayor of his town! One of his cam
2015-07-25 08:02:35 367
原创 poj 1679 The Unique MST - 次小生成树
The Unique MSTTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 23309 Accepted: 8268DescriptionGiven a connected undirected graph, tell if its minimum s
2015-07-25 07:57:25 549
原创 总结POJ
到现在还是没弄清楚oj中g++与c++有何区别。。。不过通常c++都是可以过的,g++毛病就多了。对于poj中,要注意的就是1. 输入,对于long long int 输入要用%I64d2. double型输出要用,%f,用%lf,就会wa。。。3. 要用到随机数时,比如模拟退火,srand(time(NULL))就不能用。。。否则就会re。。这个真是日了狗了。。第一次调了一下午才
2015-07-22 13:47:37 432
原创 模拟退火总结
模拟退火适用于解决一类给定范围求最优解的问题,它是一种随机搜索方法,刚开始学到后面用了几次,越用越觉得它的神奇,所以来总结一下一些通用的条件。#define P 20 随机撒点的数量#define L 10 对于每个点,随机往周围走的次数#define PI acos(-1.0) 随机生成角度时用#define RAD 10000做过几道题之后,发现随机撒点时
2015-07-22 13:36:49 556
原创 poj 1011 Sticks 经典dfs+剪枝
DescriptionGeorge took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how many stick
2015-07-22 13:21:48 523
原创 poj 3083 Children of the Candy Corn dfs+bfs
DescriptionThe cornfield maze is a popular Halloween treat. Visitors are shown the entrance and must wander through the maze facing zombies, chainsaw-wielding psychopaths, hippies, and other terrors
2015-07-22 12:05:31 415
原创 poj 2251 Dungeon Master 三维bfs
DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit
2015-07-22 12:00:26 512
原创 poj 3087 Shuffle'm Up 模拟
Shuffle'm UpTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7341 Accepted: 3396DescriptionA common pastime for poker players at a poker table is to sh
2015-07-22 11:52:14 450
原创 poj 3984 迷宫问题 bfs输出路径
迷宫问题Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10850 Accepted: 6473Description定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0,
2015-07-22 11:43:19 564
原创 zoj 1649 Rescue bfs
RescueTime Limit: 2 Seconds Memory Limit: 65536 KBAngel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M Angel's friends want to sa
2015-07-22 11:39:39 412
原创 poj 2299 Ultra-QuickSort 二分+线段树求逆序数
Ultra-QuickSortTime Limit: 7000MS Memory Limit: 65536KTotal Submissions: 47564 Accepted: 17354DescriptionIn this problem, you have to analyze a particular sorti
2015-07-22 11:21:18 500
原创 poj 3258 River Hopscotch 二分搜索
River HopscotchTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 8867 Accepted: 3815DescriptionEvery year the cows hold an event featuring a peculiar ve
2015-07-22 11:09:49 423
原创 poj 3301 Texas Trip 三分搜索
Texas TripTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4459 Accepted: 1375DescriptionAfter a day trip with his friend Dick, Harry noticed a strange
2015-07-22 10:58:40 602
原创 uva 103 Stacking Boxes dfs,记忆化
Stacking BoxesBackgroundSome concepts in Mathematics and Computer Science are simple in one or two dimensions but become more complex when extended to arbitrary dimensions. Consider solving diff
2015-07-22 10:44:18 480
原创 poj 1379 Run Away 模拟退火
Run AwayTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 7520 Accepted: 2280DescriptionOne of the traps we will encounter in the Pyramid is located in
2015-07-22 10:29:01 556
原创 hdu 5017 Ellipsoid 模拟退火
EllipsoidTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1790 Accepted Submission(s): 622Special JudgeProblem DescriptionGive
2015-07-22 10:23:30 581
原创 poj 2420 A Star not a Tree? -- 模拟退火
A Star not a Tree?Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4377 Accepted: 2164DescriptionLuke wants to upgrade his home computer network from 1
2015-07-22 10:15:28 535
原创 uvalive 6902 Three Squares - dfs
题目链接: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4914题目意思:用三个相等的正方形去覆盖所有的点,求正方形的最小边长。解题思路:首先二分边长,然后找出最小的正方形覆盖所有的点,并从这个正方形的四个顶点
2015-07-08 19:08:09 699
原创 poj 2104 K-th Number - 经典划分树
DescriptionYou are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be able
2015-07-08 18:40:05 1192 1
原创 Showstopper - POJ 3484 二分
DescriptionData-mining huge data sets can be a painful and long lasting process if we are not aware of tiny patterns existing within those data sets.One reputable company has recently discovered
2015-07-05 21:38:26 579
原创 Present - CODEFORCES, 460c 二分 扫描线求和
Little beaver is a beginner programmer, so informatics is his favorite subject. Soon his informatics teacher is going to have a birthday and the beaver has decided to prepare a present for her. He pla
2015-07-05 21:14:06 926 3
原创 Pie - POJ 3122 二分
DescriptionMy birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my par
2015-07-05 20:32:23 481
原创 Shtirlits - SGU 125 dfs
There is a checkered field of size N x N cells (1 N N2 states). Each state has an army. Let A [i, j] be the number of soldiers in the state which is located on i-th line and on j-th column of the ch
2015-07-05 20:19:08 507
原创 Drazil and Tiles - CODEFORCES 515D 贪心
Drazil created a following problem about putting 1 × 2 tiles into an n × m grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to cover
2015-07-05 20:08:27 777
原创 Cookie Selection - CF_GYM, 100112C 中位数动态查找
题目链接 CF_GYM, 100112CAs chief programmer at a cookie production plant you have many responsibilities, one of them being that the cookies produced and packaged at the plant adhere to the very demandin
2015-07-05 19:55:44 812
原创 The Geodetic Set Problem - POJ 1612 Floyd求最短路径所有点集
题目链接 POJ 1612DescriptionLet G = (V,E) be a connected graph without loops and multiple edges, where V and E are the vertex and edge, respectively, sets of G. For any two vertices u, v ∈ V ,the di
2015-07-05 19:41:39 841
原创 Working out - CODEFORCES, 429B 动态规划
题目链接 CODEFORCES 429BSummer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where they go is a matrix a with n lines and m columns. Le
2015-07-05 19:29:11 1809
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人