随笔分类 -  策略 --- 搜索

1 2 下一页

携程 决赛 第一题 Crossword
摘要://真是郁闷的一晚上//比赛时看到这题是就感觉会做,感觉思路清晰 就去准备找第二题 ,因为感觉第二题是个经典问题,(我不会计算几何),就去搜索了下,然后找到求最小面积的,改来改去,一直Wa// 然后就只剩下一个小时了 ,我决定放弃它,去写第一题 就是这题,然后整栋楼离奇断网什么的、、还调试了好久、、... 阅读全文

posted @ 2014-04-14 23:14 江财小子 阅读(317) 评论(2) 推荐(0)

poj 1426 Find The Multiple
摘要://给你一个整数 1#include #include #include #include #include #include #include using namespace std;#define LL __int64//#define LL long long#define N 1010struct node{ int num; int fa; int lf;}No[N];int h[210];void output(int id){ if(id) { output(No[id].fa); printf("%d",No[id].n... 阅读全文

posted @ 2014-03-23 22:27 江财小子 阅读(153) 评论(0) 推荐(0)

hdu 4435 charge-station
摘要:// 题意 从1出发逛完N个点回到出发点 要在这N个点选择性建设加油站 车每次加满油最多可以行使D米// 然后最少要花多少钱才能达到上述要求// 注意到 第i个城市的花费是 2^(i-1) 所以 我就从N枚举到2// 尽量让 i大的不建加油站 应为前i-1个加油站总费用都没有第i个加油站一个的费用多// 难点是怎么判断一组方案的可行性// 注意到 若i 不建加油站 那么必须存在某个加油站和他距离等于小于 (D+1)/2// 这样对于每组方案进行搜索,看下是否每个点都是可以达到并可以回到起点的// #include #include #include #include using namespa 阅读全文

posted @ 2013-08-02 15:20 江财小子 阅读(194) 评论(0) 推荐(0)

hdu 1104 Remainder
摘要:// 题意就是 n经过和m 的+ - * % 后的结果%k后 与最初的(n+1)%k 是否会相等 要是存在// 那么 求最少的步数 // 明显的模拟加bfs 不过我却忽略了2个重点:// 1. 这里 % 是 mod 就是结果必须非负// 2. a%k%m!=a%m%k // 第一点比较好解决// 第二点就是 a%km%m==a%m%km a%km%k=a%k%km 所以这个也就解决了 注:km=k*m#include #include #include #include #include #include #include #include #include using namespac... 阅读全文

posted @ 2013-07-23 15:10 江财小子 阅读(240) 评论(0) 推荐(0)

zoj 2027 Travelling Fee
摘要:// 题意 : 一个人要去旅行 给你起点和终点 求最少花费 其中花费为经过路径的总费用减去该路径的中的最大花费段// 直接搜索 稍微加了个剪枝 主要是数据规模小#include #include #include #include #include #include #include #include using namespace std;#define MOD 1000000007#define maxnmap mp;vector V[110];bool visit[110];int rc[110][110];char str1[20],str2[20];char ss[20],ts[2. 阅读全文

posted @ 2013-07-17 19:20 江财小子 阅读(381) 评论(0) 推荐(0)

POJ 1018 Communication System
摘要:Communication SystemTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 20407Accepted: 7253DescriptionWe have received an order from Pizoor Communications Inc. for a special communication system. The system consists of several devices. For each device, we are free to choose from several manufac 阅读全文

posted @ 2013-05-16 17:37 江财小子 阅读(493) 评论(0) 推荐(0)

Holedox Moving (zoj 1361 poj 1324)bfs
摘要:Holedox MovingTime Limit: 10 Seconds Memory Limit: 32768 KBDuring winter, the most hungry and severe time, Holedox sleeps in its lair. When spring comes, Holedox wakes up, moves to the exit of its lair, comes out, and begins its new life.Holedox is a special snake, but its body is not very long. ... 阅读全文

posted @ 2012-11-04 23:50 江财小子 阅读(478) 评论(0) 推荐(0)

poj 2935 Basic Wall Maze (BFS)
摘要:Basic Wall MazeTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2384Accepted: 1061Special JudgeDescriptionIn this problem you have to solve a very simple maze consisting of:a 6 by 6 grid of unit squares3 walls of length between 1 and 6 which are placed either horizontally or vertically to s. 阅读全文

posted @ 2012-11-04 23:40 江财小子 阅读(390) 评论(0) 推荐(0)

Knight Moves (zoj 1091 poj2243)BFS
摘要:Knight MovesTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8898Accepted: 5112DescriptionA friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits each square of a given set of n squares on a chessboard 阅读全文

posted @ 2012-11-04 23:37 江财小子 阅读(358) 评论(0) 推荐(0)

ZOJ 1136 Multiple BFS(POJ 1465)
摘要:MultipleTime Limit: 10 Seconds Memory Limit: 32768 KBa program that, given a natural number N between 0 and 4999 (inclusively), and M distinct decimal digits X1,X2..XM (at least one), finds the smallest strictly positive multiple of N that has no other digits besides X1,X2..XM (if such a multiple... 阅读全文

posted @ 2012-11-04 23:34 江财小子 阅读(949) 评论(0) 推荐(0)

zoj 2913 Bus Pass(BFS)
摘要:Bus PassTime Limit: 5 Seconds Memory Limit: 32768 KBYou travel a lot by bus and the costs of all the seperate tickets are starting to add up.Therefore you want to see if it might be advantageous for you to buy a bus pass.The way the bus system works in your country (and also in the Netherlands) i... 阅读全文

posted @ 2012-11-04 23:26 江财小子 阅读(323) 评论(0) 推荐(0)

zoj 2165 Red and Black (DFs)poj 1979
摘要:Red and BlackTime Limit: 2 Seconds Memory Limit: 65536 KBThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only o 阅读全文

posted @ 2012-11-04 23:21 江财小子 阅读(657) 评论(0) 推荐(0)

ZOJ 1008 Gnome Tetravex(DFS)
摘要:Gnome TetravexTime Limit: 10 Seconds Memory Limit: 32768 KBHart is engaged in playing an interesting game, Gnome Tetravex, these days. In the game, at the beginning, the player is given n*n squares. Each square is divided into four triangles marked four numbers (range from 0 to 9). In a square, t... 阅读全文

posted @ 2012-11-04 23:16 江财小子 阅读(865) 评论(0) 推荐(1)

POJ 1562 Oil Deposits (DFS)
摘要:Oil DepositsTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 9776Accepted: 5356DescriptionThe GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divides the 阅读全文

posted @ 2012-11-04 23:12 江财小子 阅读(186) 评论(0) 推荐(0)

ZOJ 3665 Yukari's Birthday
摘要:ZOJ Problem Set - 3665Yukari's BirthdayTime Limit: 2 Seconds Memory Limit: 32768 KBToday is Yukari's n-th birthday. Ran and Chen hold a celebration party for her. Now comes the most important part, birthday cake! But it's a big challenge for them to place n candles on the top of the cake 阅读全文

posted @ 2012-10-19 15:36 江财小子 阅读(416) 评论(0) 推荐(0)

hdu 1175 连连看(DFS)
摘要:连连看Time Limit: 20000/10000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10237Accepted Submission(s): 2695Problem Description“连 连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来 (这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩过连连看,咨询了同学 阅读全文

posted @ 2012-09-15 01:38 江财小子 阅读(298) 评论(0) 推荐(1)

POJ Bookshelf 2(DFS)
摘要:Bookshelf 2Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5109Accepted: 2350DescriptionFarmer John recently bought another bookshelf for the cow library, but the shelf is getting filled up quite quickly, and now the only available space is at the top.FJ has N cows (1 ≤ N ≤ 20) each with so 阅读全文

posted @ 2012-08-06 08:09 江财小子 阅读(192) 评论(0) 推荐(0)

hdu 4324 Triangle LOVE
摘要:Triangle LOVETime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 894Accepted Submission(s): 373Problem DescriptionRecently, scientists find that there is love between any of two people. For example, between A and B, if A don’t love B, then B must love 阅读全文

posted @ 2012-08-03 16:29 江财小子 阅读(933) 评论(1) 推荐(0)

poj 3126 Prime Path(BFS)
摘要:Prime PathTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 7574Accepted: 4302DescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices. — It is a matter of securit 阅读全文

posted @ 2012-08-01 16:18 江财小子 阅读(157) 评论(0) 推荐(0)

ZOJ 3631 Watashi's BG(DFS)
摘要:Watashi's BGTime Limit: 3 Seconds Memory Limit: 65536 KBWatashi is the couch of ZJU-ICPC Team and he is very kind hearted. In ZJU-ICPC summer training camp, students are divided into several groups and each day one of the groups will design some problems to hold a contest. Today students of Grou 阅读全文

posted @ 2012-07-29 21:32 江财小子 阅读(723) 评论(0) 推荐(0)

1 2 下一页