UVA 10869 - Brownie Points II
题目链接
题意:平面上n个点,两个人,第一个人先选一条经过点的垂直x轴的线,然后另一个人在这条线上穿过的点选一点作垂直该直线的线,然后划分出4个象限,第一个人得到分数为1,3象限,第二个人为二四象限,问第一个个人按最优取法,能得到最小分数的最大值,和这个值下另一个人的得分可能情况
思路:树状数组,可以枚举一点,如果能求出...
分类:
其他好文 时间:
2014-08-16 23:51:11
阅读次数:
531
题目链接:http://poj.org/problem?id=2536
题意:已知有n只老鼠的坐标,m个洞的坐标,老鼠的移动速度为V,S秒以后有一只老鹰要吃老鼠,问有多少个老鼠被吃。
很明晰,二分匹配,老鼠为X集合,洞为Y集合
#include
#include
#include
#include
#include
#include
#define i...
分类:
其他好文 时间:
2014-08-16 19:48:31
阅读次数:
239
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol...
分类:
其他好文 时间:
2014-08-15 23:47:19
阅读次数:
302
Given an integer n, generate a square matrix filled with elements from 1 to n2 in
spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[...
分类:
其他好文 时间:
2014-08-15 22:37:39
阅读次数:
274
湫湫系列故事——减肥记II
Time Limit: 5000/2000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 2395 Accepted Submission(s): 1018
Problem Description
虽然制定了减肥食谱,...
分类:
其他好文 时间:
2014-08-15 19:42:59
阅读次数:
255
原题:
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it withou...
分类:
其他好文 时间:
2014-08-15 14:46:48
阅读次数:
207
一个出栈有多少种顺序的问题。一般都知道是Catalan数了。
问题是这个Catalan数很大,故此需要使用高精度计算。
而且打表会速度快很多,打表公式要熟记:
Catalan数公式 Cn=C(2n,n) / (n+1);
递推公式 C(n ) = C(n-1)*(4*n-2) / (n+1)
高精度乘以一个整数和高精度除以一个整数的知识,这样还是使用整数数组比较好计算,如果使用str...
分类:
其他好文 时间:
2014-08-15 12:57:58
阅读次数:
263
Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6...
分类:
其他好文 时间:
2014-08-14 23:50:36
阅读次数:
270
Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use ...
分类:
其他好文 时间:
2014-08-14 23:44:26
阅读次数:
323
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol...
分类:
其他好文 时间:
2014-08-14 23:26:46
阅读次数:
219