- 博客(34)
- 收藏
- 关注
原创 USACO 3.3.3 Shopping 再做一遍
/*ID:zhaorui3PROG:shoppingLANG:C++*/# include # include # include using namespace std;struct Discount{ int cost , k[1002];};Discount disArr[102];struct Buy{ int high , buy , p;};Bu
2013-02-08 16:47:00
208
原创 USACO 3.3.2 Riding the Fences 欧拉通路
Riding the FencesFarmer John owns a large number of fences that must be repaired annually. He traverses the fences by riding a horse along each and every one of them (and nowhere else) and fixing
2013-02-06 17:02:47
295
原创 USACO 3.2.7 Sweet Butter 最短路径
Sweet ButterGreg Galperin -- 2001Farmer John has discovered the secret to making the sweetest butter in all of Wisconsin: sugar. By placing a sugar cube out in the pastures, he knows the N (1 <=
2013-02-04 14:40:26
328
原创 USACO 3.2.7 Sweet Butter 最短路径
Sweet ButterGreg Galperin -- 2001Farmer John has discovered the secret to making the sweetest butter in all of Wisconsin: sugar. By placing a sugar cube out in the pastures, he knows the N (1 <=
2013-02-04 14:36:42
154
原创 USACO 3.2.6 Magic Squares 再做一遍
/*ID:zhaorui3PROG:msquareLANG:C++*/#include #include #include #include #include using namespace std;struct Node{ Node(string _st,string _str,int _d){ st = _st; str = _str; d=_d; }
2013-02-03 11:10:47
191
原创 USACO 3.2.5 Feed Ratios 待考
Feed Ratios1998 ACM Finals, Dan AdkinsFarmer John feeds his cows only the finest mixture of cow food, which has three components: Barley, Oats, and Wheat. While he knows the precise mixture of the
2013-02-01 12:09:45
192
原创 USACO 3.2.3 Stringsobits 动态规划
StringsobitsKim SchrijversConsider an ordered set S of strings of N (1 This set of strings is interesting because it is ordered and contains all possible strings of length N that have L (1 You
2013-01-30 18:19:59
183
原创 USACO 3.1.5 Contact 动态规划
ContactIOI'98The cows have developed a new interest in scanning the universe outside their farm with radiotelescopes. Recently, they noticed a very curious microwave pulsing emission sent right fr
2013-01-28 16:15:10
289
原创 USACO 3.1.4 Shaping Regions
Shaping RegionsN opaque rectangles (1 <= N <= 1000) of various colors are placed on a white sheet of paper whose size is A wide by B long. The rectangles are put with their sides parallel to the s
2013-01-27 12:09:07
550
原创 USACO 3.1.1 Agri-Net Kruskal版本
Agri-NetRuss CoxFarmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course.Farmer Joh
2013-01-24 22:18:25
241
原创 USACO 2.4.5 Fractions to Decimals 不知道什么算法
Fractions to DecimalsWrite a program that will accept a fraction of the form N/D, where N is the numerator and D is the denominator and print the decimal representation. If the decimal representat
2013-01-24 16:48:46
202
原创 USACO 2.4.4 Bessie Come Home Dijkstra算法
Bessie Come HomeKolstad & BurchIt's dinner time, and the cows are out in their separate pastures. Farmer John rings the bell so they will start walking to the barn. Your job is to figure out which
2013-01-24 15:37:13
234
原创 USACO 2.4.2 Overfencing 广搜
OverfencingKolstad and SchrijversFarmer John went crazy and created a huge maze of fences out in a field. Happily, he left out two fence segments on the edges, and thus created two "exits" for the
2013-01-23 20:24:04
246
USACO 2.4.1
The Tamworth TwoBIO '98 - Richard ForsterA pair of cows is loose somewhere in the forest. Farmer John is lending his expertise to their capture. Your task is to model their behavior.The chase ta
2013-01-23 20:17:27
142
原创 USACO 2.3.5 Controlling Companies
Controlling CompaniesSome companies are partial owners of other companies because they have acquired part of their total shares of stock. For example, Ford owns 12% of Mazda. It is said that a com
2013-01-22 20:26:56
409
原创 USACO 2.3.4 Money Systems 动态归划
Money SystemsThe cows have not only created their own government but they have chosen to create their own money system. In their own rebellious way, they are curious about values of coinage. Tradi
2013-01-22 16:16:22
403
原创 USACO 2.3.3 Zero Sum 深搜
Zero SumConsider the sequence of digits from 1 through N (where N=9) in increasing order: 1 2 3 ... N.Now insert either a `+' for addition or a `-' for subtraction or a ` ' [blank] to run the di
2013-01-22 11:31:43
710
原创 USACO 2.3.2 Cow Pedigrees 还是动态规划
Cow PedigreesSilviu Ganceanu -- 2003Farmer John is considering purchasing a new herd of cows. In this new herd, each mother cow gives birth to two children. The relationships among the cows ca
2013-01-21 19:08:25
539
原创 USACO 2.3.1 Longest Prefix 动态规划
Longest PrefixIOI'96The structure of some biological objects is represented by the sequence of their constituents, where each part is denote by an uppercase letter. Biologists are interested in de
2013-01-20 23:22:25
375
原创 USACO 2.2.4 Subset Sums 基本动态规划
Subset SumsJRMFor many sets of consecutive integers from 1 through N (1 For example, if N=3, one can partition the set {1, 2, 3} in one way so that the sums of both subsets are identical:{3}
2013-01-19 21:58:22
1083
原创 USACO 2.1.5 Sorting a Three-Valued Sequence
Sorting a Three-Valued Sequence IOI'96 - Day 2Sorting is one of the most frequently performed computational tasks. Consider the special sorting problem in which the records to be sorted have at mo
2013-01-15 14:18:42
259
原创 USACO 3.1.3 Humble Numbers
Humble NumbersFor a given set of K prime numbers S = {p1, p2, ..., pK}, consider the set of all numbers whose prime factors are a subset of S. This set contains, for example, p1, p1p2, p1p1, and
2012-09-14 19:00:12
272
原创 USACO 3.1.2 Score Inflation 完全背包问题
Score InflationThe more points students score in our contests, the happier we here at the USACO are. We try to design our contests so that people can score as many points as possible, and would li
2012-09-12 22:42:02
559
原创 USACO 3.1.1 Agri-Net
Agri-NetRuss CoxFarmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course.Farmer Joh
2012-09-11 18:20:27
202
原创 USACO 2.4.5 Fractions to Decimals
Fractions to DecimalsWrite a program that will accept a fraction of the form N/D, where N is the numerator and D is the denominator and print the decimal representation. If the decimal representat
2012-08-18 17:23:29
137
原创 USACO 2.4.4 Bessie Come Home
Bessie Come HomeKolstad & BurchIt's dinner time, and the cows are out in their separate pastures. Farmer John rings the bell so they will start walking to the barn. Your job is to figure out which
2012-08-18 11:48:11
235
原创 USACO 2.3.3 Zero Sum
Zero SumConsider the sequence of digits from 1 through N (where N=9) in increasing order: 1 2 3 ... N.Now insert either a `+' for addition or a `-' for subtraction or a ` ' [blank] to run the di
2012-08-17 19:47:02
157
原创 USACO 2.3.4 Money Systems
Money SystemsThe cows have not only created their own government but they have chosen to create their own money system. In their own rebellious way, they are curious about values of coinage. Tradi
2012-08-17 19:34:56
199
原创 USACO 2.4.3 Cow Tours
Cow ToursFarmer John has a number of pastures on his farm. Cow paths connect some pastures with certain other pastures, forming a field. But, at the present time, you can find at least two pasture
2012-08-17 19:06:44
379
原创 USACO 2.3.5 Controlling Companies
Some companies are partial owners of other companies because they have acquired part of their total shares of stock. For example, Ford owns 12% of Mazda. It is said that a company A controls company B
2012-08-17 15:41:29
162
原创 USACO 2.4.1 The Tamworth Two
The Tamworth TwoBIO '98 - Richard ForsterA pair of cows is loose somewhere in the forest. Farmer John is lending his expertise to their capture. Your task is to model their behavior.The chase ta
2012-08-17 10:26:18
200
原创 Floyd算法 ,求两点间最短距离
Floyd算法是一种利用动态规划求解的算法,其状态转移方程为:map(i , j) = min{ map(i , k) + map(k , j) , map(i , j) }其中map(i , j)表示i到j的最短距离,k为i、j之间的每个点。由下面的例程可知时间复杂度为O(n^3)例程如下#define NUM 3int f_min(int a , int b);
2012-08-16 22:03:31
277
原创 Floyd算法——找出两点之间的最短距离
Floyd算法是一种利用动态规划求解的算法,其状态转移方程为:map(i , j) = min{ map(i , k) + map(k , j) , map(i , j) }其中map(i , j)表示i到j的最短距离,k为i、j之间的每个点。由下面的例程可知时间复杂度为O(n^3)例程如下# define NUM = 3;int f_min(int a , int b);
2012-08-16 21:59:26
182
原创 USACO 2.4.2 Overfencing
原题如下:Farmer John went crazy and created a huge maze of fences out in a field. Happily, he left out two fence segments on the edges, and thus created two "exits" for the maze. Even more happily, the
2012-08-16 14:39:17
273
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅