Description A prominent microprocessor company has enlisted your help to lay out some interchangeable components(widgets) on some of their computer ch ...
分类:
其他好文 时间:
2016-06-04 14:52:50
阅读次数:
450
分析: 用容斥来求。 公式: C(m,k)*(k*(k-1)^(n-1) – C(k,k-1)*(k-1)*(k-2)^(n-1) + C(k,k-2)*(k-2)*(k-3)^(n-1)……. ); 解释: C(m,k):m种颜色中选k种。k*(k-1)^(n-1): 至多有不超过k中颜色且相邻两... ...
分类:
其他好文 时间:
2016-05-31 22:35:24
阅读次数:
266
点击打开链接
题意:问你给出的图中有多少颗树,树的定义与最小生成树类似,不能有重边或者环
思路:直接用并查集统计一下当前集合里的边的数量以及点的数量,如果点的数量与边的数量相等,那么是一颗树,统计完即可,水题~~~#include
#include
#include
#include
#include
using namespace std;
typedef long long ll...
分类:
其他好文 时间:
2016-05-30 15:22:44
阅读次数:
112
点击打开链接
题意:在坐标上给n个点,r的操作是将两个点连起来,l的操作是问你y=u的这条线连接的集合块数和这些集合内的点的个数
思路:很麻烦的一道题,在网上看了题意和做法后,开始了一下午的调bug过程,做法很好懂,我开了两个线段树,一个维护点代表的直线的集合个数,另一个则是路过集合内的点的个数,然后集合的判断直接用并查集就行了,这是两个核心,然后就是自己瞎写的了,代码丑的可以而且好像除了...
分类:
其他好文 时间:
2016-05-30 14:52:29
阅读次数:
142
Description The mobile network market in country XYZ used to be dominated by two large corporations, XYZTelecom and XYZ Mobile. The central government ...
分类:
其他好文 时间:
2016-05-27 14:38:01
阅读次数:
275
Description There are N cities, and M directed roads connecting them. Now you want to transport K units ofgoods from city 1 to city N. There are many ...
分类:
其他好文 时间:
2016-05-23 14:35:09
阅读次数:
237
??
Dangerous Tunnels
Time Limit: 3000MS
Memory Limit: Unknown
64bit IO Format: %lld & %llu
Submit Status
Description
Somewhere in the world, there are two tr...
分类:
其他好文 时间:
2016-05-18 18:42:07
阅读次数:
179
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4621 题目大意: 求给定长度为n的数列里子序列和大于等于x的最短子序列的长度。 ...
分类:
编程语言 时间:
2016-05-09 18:48:32
阅读次数:
290
题目大意:在nxm的方格中,每一个1x1的小方格中都有一堵沿对角线的墙,并且每堵墙都有一个坚固程度,这些墙将nxm的方格分割成了若干个区域。现在要拆除一些墙,使其变成一个区域。 题目分析:将区域视作点,将墙视作边,这样问题就变成了求最小生成树。 代码如下: ...
分类:
其他好文 时间:
2016-05-07 19:37:18
阅读次数:
149
http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=22105 ...
分类:
其他好文 时间:
2016-05-06 02:01:35
阅读次数:
148