黑书上说用二分图的知识来解,但我想不出来,只好找规律发现,一条柱时为1,两条柱时为4。三条柱时为8。。这些1,3,7,11的数字加1后,都是下一条柱的最底部的数字,而且一条柱的数字之和总是按照这样的规律。1^2,2^2,3^2,4^2......所以。。 1 #include 2 #include....
分类:
其他好文 时间:
2014-06-29 00:32:08
阅读次数:
294
自己之前的不见了。。这题是双向广搜即可过。。 1 // Colour Hash (色彩缤纷游戏) 2 // PC/UVa IDs: 110807/704, Popularity: B, Success rate: average Level: 3 3 // Verdict: Accepted ...
分类:
其他好文 时间:
2014-06-28 20:42:53
阅读次数:
194
什么是算法?通俗而言,算法是一个定义明确的计算过程,可以一些值或一组值作为输入并产生一些值或一组值作为输出。因此算法就是将输入转为输出的一系列计算步骤。—Thomas H. Cormen,Chales E. Leiserson,算法入门第三版简而言之,算法就是可完成特定任务的一系列步骤,它应该具备三...
分类:
其他好文 时间:
2014-06-28 17:19:06
阅读次数:
205
题目如下:
Oil Deposits
The GeoSurvComp geologic survey company is responsible for detectingunderground oil deposits. GeoSurvComp works with one large rectangularregion of land a...
分类:
其他好文 时间:
2014-06-22 14:36:31
阅读次数:
232
题目来源:UVa 10828 Back to Kernighan-Ritchie
题意:从1开始 每次等概率从一个点到和他相邻的点 有向 走到不能走停止 求停止时每个点的期望
思路:写出方程消元 方程有唯一解 多解 无解的情况 有环 一直再环里无法停止算无穷大 从1不能到的点期望为0
#include
#include
#include
#include
#include
usin...
分类:
其他好文 时间:
2014-06-21 19:51:55
阅读次数:
338
这题有点类似LIS,由于颜色最多100种,所以只需建立一个100的数组,按对立面的关系以某种颜色为向上面的最大值就可以了。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int cube[505][7]; 7 int ...
分类:
其他好文 时间:
2014-06-21 12:58:02
阅读次数:
244
题目连接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=247&page=show_problem&problem=3666137646221225Digit CountingAccepte...
分类:
其他好文 时间:
2014-06-21 10:53:16
阅读次数:
365
题目连接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=163#ProblemVerdictLanguageRun TimeSubmission Date1...
分类:
其他好文 时间:
2014-06-20 20:23:12
阅读次数:
365
UVA 10090 - Marbles
题目链接
题意:有两种盒子,一种代价c1,能装n1个珠子,一种代价c2,能装n2个珠子,问如何正好装n个珠子,并且使得代价最少。
思路:利用扩展欧几里得算法求出n1?x+n2?y=n的一个解(x′,y′)
就可以知道x,y的通解分别为
x=x′?n/gcd(n1,n2)+n2/gcd(n1,n2)?t
y=y′?n/gac(n1,n2)?...
分类:
其他好文 时间:
2014-06-18 00:44:40
阅读次数:
182