摘要: 样例输入: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) 编辑