http://poj.org/problem?id=3617Best Cow LineTime Limit:1000MSMemory Limit:65536KTotal Submissions:10603Accepted:3187DescriptionFJ is about to take hisN...
分类:
其他好文 时间:
2014-11-07 18:32:40
阅读次数:
234
题意:给一个有向图,边严格由编号小的点到编号大的点,现在计数所有的极大路径,求每条边遍历次数的最大值。
题解:正着扫一遍,倒着扫一遍,dp值相乘。
#include
#include
#include
#define N 5050
#define M 50500
using namespace std;
struct KSD
{
int v,next;
long long cnt;
...
分类:
其他好文 时间:
2014-11-07 16:59:33
阅读次数:
225
DescriptionFJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives: half of the cows give as muc...
分类:
其他好文 时间:
2014-11-07 16:33:31
阅读次数:
170
解题思路:
1.简单动态规划。基本思想是用小的二叉树去组成大的二叉树,最后输出dp[k][n]-dp[k-1][n]恰好就是要求的n个
点组成深度最多为k的方法数
2.设dp[i][j]表示j个点组成深度最多为i的二叉树的方法数,则动态规划公式为:
dp[i][j]=∑(dp[i-1][l]*dp[i-1][j-1-l])(1<=l<=j-2)
dp[i][1]=1
3.注意:点的个数总为奇数。...
分类:
其他好文 时间:
2014-11-07 09:51:47
阅读次数:
191
继承的一个结果是派生于基类的类在方法和属性上有一定的重叠, 【从同一个基类派生出来的多个子类在方法和属性上有重叠】因此,可以使用相同的语法处理从同一个基类实例化的对象。例如,如果基类Animal有一个方法EatFood(),则从派生于它的类Cow和Chicken中调用这个方法,其语法是类似的:Co....
分类:
其他好文 时间:
2014-11-06 23:16:48
阅读次数:
120
DescriptionFarmer John'sN(1 ≤N≤ 10,000) cows are lined up to be milked in the evening. Each cow has a unique "grumpiness" level in the range 1...100,0...
分类:
其他好文 时间:
2014-11-05 16:53:49
阅读次数:
204
The Cow LexiconTime Limit:2000MSMemory Limit:65536KTotal Submissions:7909Accepted:3711DescriptionFew know that the cows have their own dictionary with...
分类:
其他好文 时间:
2014-11-05 12:40:48
阅读次数:
170
NOIP2013货车运输,只不过数据范围小了许多。
不到150s打完并且AC。。
额,当然,我写的是Floyd。
写LCA的真过分。
#include
#include
#include
#define N 305
#define inf 0x3f3f3f3f
using namespace std;
int n,m,q;
int map[N][N];
int main()
...
分类:
其他好文 时间:
2014-11-03 17:49:41
阅读次数:
184
题意:一堆奶牛去某个地方,去了又回,然后求去回和的最大值。
题解:两遍最短路,结束,邻接矩阵存边可以避免建反图。
#include
#include
#include
#define N 1005
#define inf 0x3f3f3f3f
using namespace std;
int map[N][N],n,m,s;
int dist1[N],dist2[N];
bool v...
分类:
其他好文 时间:
2014-11-03 11:35:37
阅读次数:
162
题目1633: [Usaco2007 Feb]The Cow Lexicon 牛的词典Time Limit:5 SecMemory Limit:64 MBSubmit:401Solved:216[Submit][Status]Description没有几个人知道,奶牛有她们自己的字典,里面的有W (...
分类:
其他好文 时间:
2014-11-02 23:55:09
阅读次数:
345