poj 1980 Unit Fraction Partition
来源:互联网 发布:au视频软件下载 编辑:程序博客网 时间:2024/05/27 20:03
Description
For given fourpositive integers p, q, a, and n, count the number of partitions ofp/q into unit fractions satisfying the following twoconditions.
The partition is thesum of at most n many unitfractions.
The product of thedenominators of the unit fractions in the partition is less than orequal to a.
For example, if(p,q,a,n) = (2,3,120,3), you should report 4since
enumerates all of thevalid partitions.
Input
A data set is a linecontaining four positive integers p, q, a, and n satisfying p,q<= 800, a <= 12000 and n<= 7. The integers are separated by aspace.
The terminator iscomposed of just one line which contains four zeros separated by aspace. It is not a part of the input data but a mark for the end ofthe input.
Output
The output integercorresponding to a data set p, q, a, n should be the number of allpartitions of p/q into at most n many unit fractions such that theproduct of the denominators of the unit fractions is less than orequal to a.
SampleInput
2 3 120 32 3 300 32 3 299 32 3 12 32 3 12000 754 795 12000 72 3 300 12 1 200 52 4 54 20 0 0 0
SampleOutput
4762421093
Source
#include
using
int
int
int
}
void
}
void
}
int
}
- poj 1980 Unit Fraction Partition
- [POJ 1980] Unit Fraction Partition Dfs
- POJ 1980 Unit Fraction Partition(dfs)
- poj 1980 Unit Fraction Partition…
- Poj 1980 Unit Fraction Partition (分数分解 搜索)
- poj 1980 dfs+剪枝(Unit Fraction Partition)
- poj 1980 Unit Fraction Partition 深搜剪枝
- 暴搜之1980 Unit Fraction Partition
- 2013寒假练习 1039 Unit Fraction Partition
- POJ_1980_Unit Fraction Partition
- POJ 1930 Dead Fraction
- POJ-1930-Dead Fraction
- POJ 1930Dead Fraction
- Dead Fraction POJ
- Dead Fraction POJ
- POJ 1930 Dead Fraction【数学】
- POJ 1930 Dead Fraction 数论
- Fraction
- 反转链表
- 最长回文串
- 寻找前k个最小元素——用最小堆实现…
- ios实例开发精品文章推荐(8.19)
- poj1007 DNA Sorting(求逆序数)
- poj 1980 Unit Fraction Partition
- Edmonds_Karp算法(图论)
- Prim算法
- Dijkstra算法
- Bellman-Ford算法
- Kruskal算法+并查集实现
- 昂贵的聘礼(单源最短路问题)
- 内存分段和分页的区别
- 内部碎片与外部碎片