摘要: #include#include#includeusing namespace std;const int N = 100;const int INF = 0x3f3f3f3f;struct Edge{ //用于记录一组关系 int u,v,w;};vector edge[N]; //用于保存图的关系int flag[N]; //用于标记是否在队列中int dis[N]; //源点到各点的最短距离int path[N]; //源点到各点的路径int road[N]; //用于逆向追中输出路径void init(int n){ for(int... 阅读全文
posted @ 2013-07-30 11:58 哥的笑百度不到 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 确定比赛名次Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8229Accepted Submission(s): 3169Problem Description有N个比赛队(1#include#include#include#includeusing namespace std;int map[505][505],indrgee[505];int main(){ int n,m,i,j; whi... 阅读全文
posted @ 2013-07-30 10:11 哥的笑百度不到 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 畅通工程续Time Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 19475Accepted Submission(s): 6742Problem Description某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走... 阅读全文
posted @ 2013-07-30 09:20 哥的笑百度不到 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 样例输入:70 1 60 2 50 3 51 4 -12 1 -22 4 13 2 -23 5 -14 6 35 6 3-1 -1 -1样例输出1 0→3→2→13 0→3→25 0→30 0→3→2→1→44 0→3→53 0→3→2→1→4→6#include #include #define INF 1000000 //无穷大#define MAXN 20 //顶点个数最大值int n; //顶点个数int Edge[MAXN][MAXN]; //邻接矩阵int dist... 阅读全文
posted @ 2013-07-29 16:46 哥的笑百度不到 阅读(193) 评论(0) 推荐(0) 编辑
摘要: Idiomatic Phrases GameTime Limit:2 Seconds Memory Limit:65536 KBTom is playing a game calledIdiomatic Phrases Game. An idiom consists of several Chinese characters and has a certain meaning. This game will give Tom two idioms. He should build a list of idioms and the list starts and ends with the tw 阅读全文
posted @ 2013-07-29 15:58 哥的笑百度不到 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 样例输入:60 2 50 3 301 0 21 4 82 5 72 1 154 3 45 3 105 4 18-1 -1 -1样例输出:20 0->2->15 0->222 0->2->5->328 0->2->1->412 0->2->5#include #include #define INF 1000000 //无穷大#define MAXN 20 //顶点个数的最大值int n; //顶点个数int Edge[MAXN][MAXN]; //邻接矩阵int S[MAXN]; //Dijkstra算法用到的3个数组... 阅读全文
posted @ 2013-07-29 15:27 哥的笑百度不到 阅读(343) 评论(0) 推荐(0) 编辑
摘要: 样例输入:2 // 测试数据个数6 1 3 // 棋盘大小 蛇的个数 梯子个数35 25 // 蛇的起始位置(蛇头) 蛇的终止位置(蛇尾)3 23 5 16 20 33 梯子起始位置(梯子底部) 梯子终止位置(顶部)样例输出:3#include #include #define NMAX 20#define SLMAX 200struct SnakeAndLadder //蛇和梯子{ int from, to; //起止位置};int main( ){ int D; //测试数据的个数 int N, S, L; //每个测试数据中的N、S、L:棋... 阅读全文
posted @ 2013-07-29 11:09 哥的笑百度不到 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 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 #include #include #define MAXMN 200#define INF 1000000 //走到每个位置所需时间的初始值为无穷大using namespace std;struct point //表示到达某个方格时的状态{ int x, y; ... 阅读全文
posted @ 2013-07-29 09:51 哥的笑百度不到 阅读(186) 评论(0) 推荐(0) 编辑
摘要: A Knight's JourneyTime Limit:1000MSMemory Limit:65536KTotal Submissions:25463Accepted:8672DescriptionBackgroundThe knight is getting bored of seeing the same black and white squares again and again and has decided to make a journeyaround the world. Whenever a... 阅读全文
posted @ 2013-07-28 20:48 哥的笑百度不到 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 下沙小面的(2)Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1131Accepted Submission(s): 429Problem Description前文再续,书接上一题。话说当上小面的司机的Lele在施行他的那一套拉客法则以后,由于走的路线太长,油费又贵,不久便亏本了。(真可怜~)于是他又想了一个拉客的办法。对于每一次拉客活动,他一次性把乘客都拉上车(当然也不会超过7个,因为位置只有7个)。然后,Lele计算出一条路线(出于某些 阅读全文
posted @ 2013-07-28 18:30 哥的笑百度不到 阅读(257) 评论(0) 推荐(0) 编辑