圆木摆放,上层的必须比下层至少少一个,每层必须连续,问当最下层的圆木个数是 n 的时候可能的摆放有多少种?
递归式:
a[1] = 1
a[2] = 2
a[3] - a[2] = a[2] + a[1]
a[4] - a[3] = a[3] + a[2] + a[1]
......
a[n] - 3a[n-1] + a[n-2] = 0
Read the rest of this entry »
Published by chenyajun under Category:
POJ
给定 n 个包,每个包都有一个容量,一个包的容量如果小于另外一个包,则它可以被装入到那个容量较大的包中,那么最后最少的包是多少个?
Read the rest of this entry »
Tags: 基本问题 Published by chenyajun under Category:
POJ
n 条线,交成 m 个交点,是否可能?如果可能,那么可以把平面分成多少个区域?
Read the rest of this entry »
Tags: 数学问题 Published by chenyajun under Category:
POJ
直接递推。
题目描述:一个地图软件需要需要存储h个房子的坐标信息,但为节约存储空间可以只存储其中的m个房子的坐标信息
其他房子的坐标信息可以由插值得到。问怎样选择这个m个房子,使得所有房子的插值误差之和最小, 输出最小的插值误差均值。
Read the rest of this entry »
Tags: 数学问题 Published by chenyajun under Category:
POJ
一个图,左边 N 个点,右边 M 个点,有 K 条线连接两边,问有多少个交叉。
树状数组。
其实就是求逆序对吧。
Read the rest of this entry »
Tags: 树状数组 Published by chenyajun under Category:
POJ
有 m 个序列,每个序列 n 个元素,从每个序列中选择一个元素形成一个长度为 m 的序列,可以有很多取法,计算它们的和,一共可以形成 n^m 个和,,问其中最小的 n 个和是多少?
Read the rest of this entry »
Tags: 堆 Published by chenyajun under Category:
POJ
Tags: 排列组合 Published by chenyajun under Category:
POJ
建两个堆,一个用于筛出最大的 n1 个数,另外一个用户筛出最小的 n2 个数,待读入完成之后减掉它们即可。
Tags: 堆 Published by chenyajun under Category:
POJ
有一些订单需要完成,一个时刻只能完成一个订单,一个单位时间完成一个单位量。
订单有期限,问如何安排才能使得尽可能多的订单被满足。
要使得被拒绝的order尽可能小,每个订单有两个属性,一个是需要的量,每单位量需要单位时间,还有一个是期限,
优先队列 首先我们把任务放入到队列中,记录下最后时刻,如果新的一个任务进来,可以在截至日期前做完,那么放入队列,如果这个任务用时比任务队列中时间最久的那个小,那么用这个任务去替代最大的那个一定不吃亏,最后队列的大小就是最大的处理个数。
Tags: 堆 , 队列 Published by chenyajun under Category:
POJ
从一个序列中选择一个最短连续的子序列,使得其能包括原序列中的所有元素。
Read the rest of this entry »
Published by chenyajun under Category:
POJ
office 始终在点 1,home 始终在点 2。
先算出各个点到 home 的最短路径。
再来一个搜索。
Read the rest of this entry »
Tags: Dijkstra Published by chenyajun under Category:
POJ
一个数被称为是 H 半素数,如果可以表示为 4n + 1 并且只是两个半素数的乘积。
Read the rest of this entry »
Tags: 数学问题 Published by chenyajun under Category:
POJ
一群人围城一圈喝啤酒,每个人喝一种品牌的啤酒,现在要敬酒,每个人只能和那些喝相同品牌的人敬酒,不交叉的情况下最多能有几对?

Read the rest of this entry »
Tags: DP Published by chenyajun under Category:
POJ
Tags: DP Published by chenyajun under Category:
POJ
给定 n 和 m,问 n 的阶乘 n! 是否是 m 的倍数。
因式分解。对于 m 的因子 i,记录 m 分解之后因子(注意分解出来的因子要都是素数) i 的个数 num1,然后看 1 到 n 有多少个数是 i 的倍数。
Read the rest of this entry »
Tags: 数论 Published by chenyajun under Category:
POJ