题目大意:豆子数i (1~m)分到n颗树上。 树可以为空,那么对于每个i,分配方式是 C(n+i-1,n-1)......于是我用for(i=0-->m)做,不幸超时,m太大。
不过竟然公式可以化简:
for(int i=0;i
C(n+i-1,n-1)=C(n+i-1,i)
组合原理:
公式 C(n,k) = C(n-1,k)+C(n-1,k-1...
分类:
其他好文 时间:
2014-08-01 16:05:32
阅读次数:
245
Problem Description
Bean-eating is an interesting game, everyone owns an M*N matrix, which is filled with different qualities beans. Meantime, there is only one bean in any 1*1 grid. Now you want t...
分类:
其他好文 时间:
2014-07-30 20:46:54
阅读次数:
262
正确的springmvc配置如下: <?xml?version="1.0"?encoding="UTF-8"?>
<beans?xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?xmlns:context...
分类:
编程语言 时间:
2014-07-28 17:00:04
阅读次数:
278
java.io.FileNotFoundException: class path resource [beans.xml] cannot be opened because it does not exit.
在用maven管理的spring项目中做单元测试时候,加载不了spring的配置文件。出现该问题的原因是,用maven创建的项目,必须把spring的配置文件beans.xml或者app...
分类:
编程语言 时间:
2014-07-28 15:56:13
阅读次数:
187
本来是很简单的一道题,却想了好长时间由于数据量比较大,所以逐行读入,逐行处理先处理每一行的不相邻元素和的最大值,记录在数组b中最后计算不相邻行的和的最大值二者的状态转移方程都类似:dp[j] = max(dp[j - 1], dp[j - 2] + a[j]); 1 //#define LOCAL ...
分类:
其他好文 时间:
2014-07-27 11:06:02
阅读次数:
221
快捷键命令作用快捷键序列Open Java TypeCtrl+Alt+TShow In Spring Beans ViewCtrl+Alt+VZoom InCtrl+=Zoom OutCtrl+-关闭用户帮助托盘Ctrl+F4关闭用户帮助托盘Ctrl+W在工作空间中查找文本Ctrl+Alt+G工作空...
分类:
系统相关 时间:
2014-07-26 09:49:47
阅读次数:
306
hdu 3037 Saving Beans题目大意:n个数,和不大于m的情况,结果模掉p,p保证为素数。解题思路:隔板法,C(nn+m)多选的一块保证了n个数的和小于等于m。可是n,m非常大,所以用到Lucas定理。#include #include #include using namespace...
分类:
其他好文 时间:
2014-07-25 13:59:21
阅读次数:
222
spring-db-context.xml:<?xmlversion="1.0"encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http:..
分类:
编程语言 时间:
2014-07-23 13:44:37
阅读次数:
311
HDU 2845 Beans (动规)
这道题意思可以转换成:
对每一行,不能有间隔的取一个子序列,即取该行的最大不连续子序列和;
再从上面所有值中,取其最大不连续子序列和;就相当于隔一行取了...
分类:
其他好文 时间:
2014-07-22 22:38:35
阅读次数:
256
使用步骤: 步骤一、在spring配置文件中引入<tx:>命名空间 <beans xmlns="http://www.springframework.org/schema/beans" ?xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ?xmlns:tx="http://www.spri...
分类:
编程语言 时间:
2014-07-21 23:29:22
阅读次数:
392