上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页
摘要: 题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=211思路:我的思路是对每一个点,向上广搜,向下广搜,看总共能不能搜到n-1个结点,能,表明该节点的等级确定。题目标程给的方法是floyd+统计,似乎简单的多,我弄复杂了,还是贴个代码吧!代码... 阅读全文
posted @ 2014-05-22 15:37 ruo_yu 阅读(354) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=203思路:先求点0到每个点的最短距离,dijkstra算法,然后就是01背包了我奇怪的是100*1000000的时间复杂度居然没有超时!代码如下:#include "stdio.h"#inc... 阅读全文
posted @ 2014-05-22 12:28 ruo_yu 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=170思路:统计每个节点的度,将度为1的节点消去所需要的最少的边即为答案。代码:#include "stdio.h" //nyoj 170 网络的可靠性#include "string.h"... 阅读全文
posted @ 2014-05-22 11:36 ruo_yu 阅读(210) 评论(1) 推荐(0) 编辑
摘要: 题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=120思路:先将原图强连通缩点为新图,统计新图中入度,出度为0的点的个数,两者取最大值即为答案。代码如下:#include "stdio.h"#include "string.h"#inclu... 阅读全文
posted @ 2014-05-22 10:39 ruo_yu 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=115dijkstra算法。#include "stdio.h"#include "string.h"#define N 1005#define INF 0x3fffffffbool vis[... 阅读全文
posted @ 2014-05-22 08:36 ruo_yu 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=42欧拉回路,欧拉路径水题~代码:#include "stdio.h" // 欧拉图,半欧拉图#include "string.h"//无向图存在欧拉路径的充要条件:连通且奇度顶点个数为2。... 阅读全文
posted @ 2014-05-20 17:20 ruo_yu 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=38最小生成树水题~代码:#include "stdio.h" // 最小生成树 Kruskal#include "string.h"#include "stdlib.h"#define N... 阅读全文
posted @ 2014-05-20 17:05 ruo_yu 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 不要62Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Problem Description杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。杭州交通管理局经常会扩充一些的士车牌照,新... 阅读全文
posted @ 2014-05-20 16:27 ruo_yu 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 问题 D: 探 寻 宝 藏时间限制:1 Sec内存限制:128 MB题目描述传说HMH大沙漠中有一个M*N迷宫,里面藏有许多宝物。某天,Dr.Kong找到了迷宫的地图,他发现迷宫内处处有宝物,最珍贵的宝物就藏在右下角,迷宫的进出口在左上角。当然,迷宫中的通路不是平坦的,到处都是陷阱。Dr.Kong决... 阅读全文
posted @ 2014-05-19 18:01 ruo_yu 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 1451: Semiconnected时间限制:1 Sec内存限制:32 MB提交:79解决:20题目描述For a directed graph G = (V, E), if for all pairs of nodes u,v, u can always reach v or v can alw... 阅读全文
posted @ 2014-05-19 08:19 ruo_yu 阅读(268) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页