- 博客(34)
- 收藏
- 关注
原创 USACO 3.3.3 Shopping 再做一遍
/* ID:zhaorui3 PROG:shopping LANG: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 146
原创 USACO 3.3.2 Riding the Fences 欧拉通路
Riding the Fences Farmer 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 216
原创 USACO 3.2.7 Sweet Butter 最短路径
Sweet Butter Greg Galperin -- 2001 Farmer 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 257
原创 USACO 3.2.7 Sweet Butter 最短路径
Sweet Butter Greg Galperin -- 2001 Farmer 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 80
原创 USACO 3.2.6 Magic Squares 再做一遍
/* ID:zhaorui3 PROG:msquare LANG: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 133
原创 USACO 3.2.5 Feed Ratios 待考
Feed Ratios 1998 ACM Finals, Dan Adkins Farmer 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 123
原创 USACO 3.2.3 Stringsobits 动态规划
Stringsobits Kim Schrijvers Consider 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 124
原创 USACO 3.1.5 Contact 动态规划
Contact IOI'98 The 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 219
原创 USACO 3.1.4 Shaping Regions
Shaping Regions N 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 452 2
原创 USACO 3.1.1 Agri-Net Kruskal版本
Agri-Net Russ Cox Farmer 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 181
原创 USACO 2.4.5 Fractions to Decimals 不知道什么算法
Fractions to Decimals Write 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 141
原创 USACO 2.4.4 Bessie Come Home Dijkstra算法
Bessie Come Home Kolstad & Burch It'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 170
原创 USACO 2.4.2 Overfencing 广搜
Overfencing Kolstad and Schrijvers 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
2013-01-23 20:24:04 172
USACO 2.4.1
The Tamworth Two BIO '98 - Richard Forster A 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 82
原创 USACO 2.3.5 Controlling Companies
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 com
2013-01-22 20:26:56 325
原创 USACO 2.3.4 Money Systems 动态归划
Money Systems The 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 319
原创 USACO 2.3.3 Zero Sum 深搜
Zero Sum Consider 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 623
原创 USACO 2.3.2 Cow Pedigrees 还是动态规划
Cow Pedigrees Silviu Ganceanu -- 2003 Farmer 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 455
原创 USACO 2.3.1 Longest Prefix 动态规划
Longest Prefix IOI'96 The 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 295
原创 USACO 2.2.4 Subset Sums 基本动态规划
Subset Sums JRM For 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 967 1
原创 USACO 2.1.5 Sorting a Three-Valued Sequence
Sorting a Three-Valued Sequence IOI'96 - Day 2 Sorting 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 194
原创 USACO 3.1.3 Humble Numbers
Humble Numbers For 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 215
原创 USACO 3.1.2 Score Inflation 完全背包问题
Score Inflation The 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 476
原创 USACO 3.1.1 Agri-Net
Agri-Net Russ Cox Farmer 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 143
原创 USACO 2.4.5 Fractions to Decimals
Fractions to Decimals Write 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 82
原创 USACO 2.4.4 Bessie Come Home
Bessie Come Home Kolstad & Burch It'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 172
原创 USACO 2.3.3 Zero Sum
Zero Sum Consider 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 90
原创 USACO 2.3.4 Money Systems
Money Systems The 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 134
原创 USACO 2.4.3 Cow Tours
Cow Tours Farmer 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 294
原创 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 104
原创 USACO 2.4.1 The Tamworth Two
The Tamworth Two BIO '98 - Richard Forster A 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 143
原创 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 22:03:31 207
原创 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 113
原创 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 211
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人