某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数 ...
分类:
其他好文 时间:
2019-05-18 14:06:36
阅读次数:
117
离线做法 对给出的树作树剖 把每个询问区间先加入线段树的结点 后对线段树每个有询问的节点建立AC自动机 对每个节点单独询问 1 // #include <bits/stdc++.h> 2 #include <iostream> 3 #include <cstdio> 4 #include <queu ...
分类:
其他好文 时间:
2019-05-18 12:23:06
阅读次数:
105
题目链接:https://vjudge.net/problem/HDU-1532 题目大意 给定 m 个点,n 条边,以及每条边的容量 c,求从原点 1 到汇点 m 的最大流。 分析: 网络流模板题。 代码如下 1 #include <bits/stdc++.h> 2 using namespace ...
分类:
其他好文 时间:
2019-05-17 13:52:48
阅读次数:
141
Lele now is thinking about a simple function f(x). If x < 10 f(x) = x. If x >= 10 f(x) = a0 * f(x-1) + a1 * f(x-2) + a2 * f(x-3) + …… + a9 * f(x-10); ...
分类:
其他好文 时间:
2019-05-17 12:12:04
阅读次数:
156
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2099 Problem Description 一个整数,只知道前几位,不知道末二位,被另一个整数除尽了,那么该数的末二位该是什么呢? Input 输入数据有若干组,每组数据包含二个整数a,b(0<a<1 ...
分类:
其他好文 时间:
2019-05-17 09:29:51
阅读次数:
146
soda has an integer array a1,a2,…,ana1,a2,…,an. Let S(i,j)S(i,j) be the sum of ai,ai+1,…,ajai,ai+1,…,aj. Now soda wants to know the value below: ∑i=1n ...
分类:
其他好文 时间:
2019-05-16 16:26:39
阅读次数:
115
链接:https://vjudge.net/problem/HDU-2119#author=Smilencer 题意: 众所周知,tyz是一个写bug小能手,以至于如果没有队友的帮助,就ac不了程序。 今天可怜的XJL又被抓来出数据debug了,你要帮助他以最少的样例消灭所有程序的bug 数据以矩阵 ...
分类:
其他好文 时间:
2019-05-15 21:42:52
阅读次数:
129
链接:https://vjudge.net/problem/HDU-1179 题意: 有n个法师和m个魔棒,每个法师喜欢多种魔棒,但每个法师只能在喜欢的魔棒中选一个。 求最多有几个法师能选到魔棒。 思路: 二分图最大匹配,因为题目是魔棒对应的法师,所以输入处理一下。 代码: ...
分类:
其他好文 时间:
2019-05-15 15:54:30
阅读次数:
146
http://acm.hdu.edu.cn/showproblem.php?pid=2544 ...
分类:
其他好文 时间:
2019-05-14 19:30:10
阅读次数:
261
A - I Hate It HDU - 1754 模板,单点更新,区间查询 1 #include <iostream> 2 #include <cstring> 3 #include <string> 4 #include <map> 5 #include <set> 6 #include <alg ...
分类:
其他好文 时间:
2019-05-13 22:49:29
阅读次数:
133