题目描述 Bessie is planning the annual Great Cow Gathering for cows all across the country and, of course, she would like to choose the most convenient lo ...
分类:
其他好文 时间:
2018-07-21 22:46:40
阅读次数:
194
题目描述 To avoid unsightly burns while tanning, each of the C (1 ≤ C ≤ 2500) cows must cover her hide with sunscreen when they're at the beach. Cow i has ...
分类:
其他好文 时间:
2018-07-18 20:36:34
阅读次数:
123
题意: 求出n个节点可以构成多少种高为h的二叉树。分析: 设左子树节点数x,右子树节点数为n-x-1,函数dp表示满足条件的树的个数,则dp(n)=dp(x)*(n-x-1)。 对于未知数h,dp[n]=∑dp[x]*dp[n-x-1],(x<=n-2,x in [1,3,5,…])。 故设dp[i ...
分类:
其他好文 时间:
2018-07-17 14:20:36
阅读次数:
126
显然二分答案,然后减去对应的mid,求超过L的最大子段和验证就好了。 当然记录下长度的直接DP也是可以的。 然而二分答案怎么都WA,很好奇为什么 直接输出r反而是能过的。 看了下https://blog.csdn.net/jiangshibiao/article/details/21963437 想 ...
分类:
其他好文 时间:
2018-07-15 16:10:55
阅读次数:
419
Description Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,00 ...
分类:
其他好文 时间:
2018-07-15 14:58:32
阅读次数:
179
题目描述 One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A ...
分类:
其他好文 时间:
2018-07-14 16:46:21
阅读次数:
185
看到许多大佬都用了拓补排序,本蒟蒻偏不用这么~~高级的~~算法,其实这道题目用dfs就可以过了。(ps:对本题解有疑惑的person可以向我留下评论) 思路: 我们先来考虑一下怎么样我们才可以确定一个牛的排名,我们如果假设赢了或间接赢了这个牛的牛数为sum_win,输了或间接输掉的牛数为sum_lo ...
分类:
其他好文 时间:
2018-07-12 19:58:15
阅读次数:
114
题目描述 FJ's N (1 ≤ N ≤ 10,000) cows conveniently indexed 1..N are standing in a line. Each cow has a positive integer height (which is a bit of secret). ...
分类:
其他好文 时间:
2018-07-11 21:24:24
阅读次数:
152
大致题意: 给定两个整数n和k 通过 n+1或n-1 或n*2 这3种操作,使得n==k 输出最少的操作次数 解题思路: 三入口的BFS 注意的地方: 由于用于广搜的 队列数组 和 标记数组 相当大,如果定义这两个数组时把它们扔到局部去,编译是可以的,但肯定执行不了,提交就等RE吧= = 大数组必须 ...
分类:
其他好文 时间:
2018-07-11 20:40:09
阅读次数:
110
题意:给一个起点和终点,只有三种走法n+1, n-1, n*2, 求最短需要的步数 解题思路:BFS,用BFS解决无权图的最短路问题。 注:很容易re,我re了10多次,有两个点要注意 1.如果起始点s>=终点e那么,就只能回退,所以step=s-e 2.编号不可能出边界(0, MAXSIZE) ...
分类:
其他好文 时间:
2018-07-11 12:29:08
阅读次数:
162