随笔分类 - ACM_水题集合
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5641 题目类型:水题 题目思路:将点x到点y所需要跨过的点存入mark[x][y]中(无需跨过其它点存0),然后按照题目给的路径逐一判断是否可走,得出结果。 需要判断的: 1.给出的点是否在1~9之间
阅读全文
摘要:题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=284题意:在一个给定图中,铁墙,河流不可走,砖墙走的话,多花费时间1,问从起点到终点至少需要多少时间。思路:简单广搜~代码如下:#include "stdio.h" //nyoj 284...
阅读全文
摘要:题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=237二分匹配--最小点覆盖模板题Tips:用邻接矩阵超时,用数组模拟邻接表WA,暂时只有vector过了!代码如下://最小点覆盖 = 最大匹配数//最大独立集 = N - 最大匹配数#in...
阅读全文
摘要:题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=230题意:给你许许多多的木棍,没条木棍两端有两种颜色,问你在将木棍相连时,接触的端点颜色必须相同,是否能把它们都连起来思路:很明显的欧拉路径,但题目给的字符串数据很大,得用字典树存取。代码如...
阅读全文
摘要:题目链接: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=115dijkstra算法。#include "stdio.h"#include "string.h"#define N 1005#define INF 0x3fffffffbool vis[...
阅读全文
摘要:题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=42欧拉回路,欧拉路径水题~代码:#include "stdio.h" // 欧拉图,半欧拉图#include "string.h"//无向图存在欧拉路径的充要条件:连通且奇度顶点个数为2。...
阅读全文
摘要:题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=38最小生成树水题~代码:#include "stdio.h" // 最小生成树 Kruskal#include "string.h"#include "stdlib.h"#define N...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3714懂了三分思想和F(x)函数的单调性质,这题也就是水题了#include "stdio.h" //最后得到的F(x)函数要么是单调的,要么是先减后增的,有了这个性质,就可以三分了~#include ...
阅读全文
摘要:C. Triangletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a right triangle with legs of...
阅读全文
浙公网安备 33010602011771号