摘要:
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=211思路:我的思路是对每一个点,向上广搜,向下广搜,看总共能不能搜到n-1个结点,能,表明该节点的等级确定。题目标程给的方法是floyd+统计,似乎简单的多,我弄复杂了,还是贴个代码吧!代码... 阅读全文
摘要:
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=203思路:先求点0到每个点的最短距离,dijkstra算法,然后就是01背包了我奇怪的是100*1000000的时间复杂度居然没有超时!代码如下:#include "stdio.h"#inc... 阅读全文
摘要:
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=170思路:统计每个节点的度,将度为1的节点消去所需要的最少的边即为答案。代码:#include "stdio.h" //nyoj 170 网络的可靠性#include "string.h"... 阅读全文
摘要:
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=120思路:先将原图强连通缩点为新图,统计新图中入度,出度为0的点的个数,两者取最大值即为答案。代码如下:#include "stdio.h"#include "string.h"#inclu... 阅读全文
摘要:
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=115dijkstra算法。#include "stdio.h"#include "string.h"#define N 1005#define INF 0x3fffffffbool vis[... 阅读全文