![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
zrw93
这个作者很懒,什么都没留下…
展开
-
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 · 119 阅读 · 0 评论 -
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 · 220 阅读 · 0 评论 -
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 · 323 阅读 · 0 评论 -
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 · 259 阅读 · 0 评论 -
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 · 127 阅读 · 0 评论 -
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 · 127 阅读 · 0 评论 -
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 · 223 阅读 · 0 评论 -
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 · 455 阅读 · 2 评论 -
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 · 479 阅读 · 0 评论 -
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 · 183 阅读 · 0 评论 -
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 · 173 阅读 · 0 评论 -
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 · 145 阅读 · 0 评论 -
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 · 327 阅读 · 0 评论 -
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 · 173 阅读 · 0 评论 -
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 · 625 阅读 · 0 评论 -
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 · 148 阅读 · 0 评论