- 博客(196)
- 收藏
- 关注
转载 基础线段树总结
基础线段树是一些基本操作之间的组合:基本操作:单点更新、单点查询、区间更新,区间求和、区间最值1、单点增减,区间求和http://acm.hdu.edu.cn/showproblem.php?pid=1166View Code #include<algorithm>#include<cstring>#include<cstdi...
2012-10-03 15:01:00
240
转载 USACO Section 4.1 Fence Rails(DFSID)
Fence RailsBurch, Kolstad, and SchrijversFarmer John is trying to erect a fence around part of his field. He has decided on the shape of the fence and has even already installed the posts, but ...
2012-09-27 20:58:00
266
转载 USACO Section 4.1 Beef McNuggets(数论 & 背包)
Beef McNuggetsHubert ChenFarmer Brown's cows are up in arms, having heard that McDonalds is considering the introduction of a new product: Beef McNuggets. The cows are trying to find any possib...
2012-09-26 14:17:00
263
转载 USACO Section 3.4 Closed Fences(离散化 & 线段规范相交 & 线段非规范相交)
Closed FencesA closed fence in the plane is a set of non-crossing, connected line segments with N corners (3 < N < 200). The corners or vertices are each distinct and are listed in counte...
2012-09-21 09:43:00
237
转载 USACO Section 3.4 American Heritage(知先序中序求后序)
American HeritageFarmer John takes the heritage of his cows very seriously. He is not, however, a truly fine bookkeeper. He keeps his cow genealogies as binary trees and, instead of writing the...
2012-09-19 15:46:00
239
转载 USACO Section 3.4 A Electric Fence
Electric FenceDon PieleIn this problem, `lattice points' in the plane are points with integer coordinates.In order to contain his cows, Farmer John constructs a triangular electric fence by s...
2012-09-19 13:01:00
136
转载 USACO Section 3.4 Raucous Rockers(状态压缩或DFS)
Raucous RockersYou just inherited the rights to N (1 <= N <= 20) previously unreleased songs recorded by the popular group Raucous Rockers. You plan to release a set of M (1 <= M <=...
2012-09-18 22:35:00
143
转载 USACO Section 3.3 Shopping Offers(dp)
Shopping OffersIOI'95In a certain shop, each kind of product has an integer price. For example, the price of a flower is 2 zorkmids (z) and the price of a vase is 5z. In order to attract more c...
2012-09-18 21:02:00
117
转载 USACO Section 3.3 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 fixi...
2012-09-18 10:41:00
139
转载 欧拉路径和欧拉回路的路径
欧拉路径和欧拉回路欧拉路径:从某结点出发一笔画成所经过的路线叫做欧拉路径。欧拉回路:在欧拉路径的基础上又回到起点。a、凡是由偶点组成的连通图,一定可以一笔画成。画时可以把任一偶点为起点,最后一定能以这个点为终点画完此图。 b、凡是只有两个奇点的连通图(其余都为偶点),一定可以一笔画成。画时必须把一个奇点为起点,另一个奇点终点。 c、其他情况的图都不能一笔画出。(有偶数个奇点...
2012-09-18 09:53:00
259
转载 USACO Section 3.3 Camelot(搜索)
CamelotIOI 98Centuries ago, King Arthur and the Knights of the Round Table used to meet every year on New Year's Day to celebrate their fellowship. In remembrance of these events, we consider a...
2012-09-17 14:09:00
138
转载 USACO Section 3.3 Home on the Range(dp)
Home on the RangeFarmer John grazes his cows on a large, square field N (2 <= N <= 250) miles on a side (because, for some reason, his cows will only graze on precisely square land segmen...
2012-09-15 15:25:00
154
转载 USACO Section 3.3 A Game(dp)
A GameIOI'96 - Day 1Consider the following two-player game played with a sequence of N positive integers (2 <= N <= 100) laid onto a game board. Player 1 starts the game. The players move...
2012-09-15 10:37:00
141
转载 USACO Section 3.2 Spinning Wheels(模拟)
Spinning Wheels1998 ACM NE RegionalsEach of five opaque spinning wheels has one or more wedges cut out of its edges. These wedges must be aligned quickly and correctly. Each wheel also has an a...
2012-09-14 15:27:00
150
转载 USACO Section 3.2 Stringsobits(dp)
StringsobitsKim SchrijversConsider an ordered set S of strings of N (1 <= N <= 31) bits. Bits, of course, are either 0 or 1.This set of strings is interesting because it is ordered and ...
2012-09-14 11:22:00
157
转载 USACO Section 3.2 Sweet Butter(SPFA)
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 ...
2012-09-13 21:49:00
158
转载 USACO Section 3.2 Magic Squares(BFS)
Magic SquaresIOI'96Following the success of the magic cube, Mr. Rubik invented its planar version, called magic squares. This is a sheet composed of 8 equal-sized squares:1234...
2012-09-13 20:49:00
123
转载 USACO Section 3.2 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 ...
2012-09-13 18:37:00
158
转载 USACO Section 3.2 Factorials(n!求最右边非零数)
FactorialsThe factorial of an integer N, written N!, is the product of all the integers from 1 through N inclusive. The factorial quickly becomes very large: 13! is too large to store in a 32-b...
2012-09-13 14:22:00
125
转载 USACO Section 3.1 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 para...
2012-09-13 11:26:00
122
转载 USACO Section 3.1 Contact(map)
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...
2012-09-12 16:54:00
777
转载 USACO Section 3.1 Stamps(背包变形)
StampsGiven a set of N stamp values (e.g., {1 cent, 3 cents}) and an upper limit K to the number of stamps that can fit on an envelope, calculate the largest unbroken list of postages from 1 ce...
2012-09-12 09:31:00
189
转载 USACO Section 3.1 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, an...
2012-09-11 17:36:00
118
转载 USACO Section 3.1 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...
2012-09-11 10:50:00
177
转载 USACO Section 3.1 Agri-Net(prim)
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 ...
2012-09-11 09:27:00
129
转载 USACO Section 2.4 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 represen...
2012-09-10 21:55:00
107
转载 hdu4282 A very hard mathematic problem
A very hard mathematic problemTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 991Accepted Submission(s): 287Problem Description ...
2012-09-10 17:34:00
139
转载 hdu4268 Alice and Bob(贪心+multiset)
Alice and BobTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 559Accepted Submission(s): 224Problem DescriptionAlice and Bob's ga...
2012-09-10 15:41:00
150
转载 USACO Section 2.4 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...
2012-09-07 22:43:00
144
转载 USACO Section 2.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 ou...
2012-09-07 16:59:00
173
转载 USACO Section 2.4 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 past...
2012-09-07 11:15:00
178
转载 USACO Section 2.4 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 ...
2012-09-06 10:10:00
168
转载 USACO Section 2.3 Zero Sum(dfs+双向队列)
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...
2012-09-05 14:00:00
136
转载 USACO Section 2.3 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...
2012-09-05 11:07:00
89
转载 USACO Section 2.3 Cow Pedigrees(dp)
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 c...
2012-09-04 21:26:00
130
转载 USACO Section 2.3 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. Tr...
2012-09-04 15:57:00
135
转载 USACO Section 2.3 Controlling Companies(DFS)
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 ...
2012-09-04 15:23:00
169
转载 USACO Section 2.2 Preface Numbering
Preface NumberingA certain book's prefaces are numbered in upper case Roman numerals. Traditional Roman numeral values use a single letter to represent a certain subset of decimal numbers. Here...
2012-09-03 20:40:00
176
转载 USACO Section 2.2 Party Lamps(dfs)
Party LampsIOI 98To brighten up the gala dinner of the IOI'98 we have a set ofN(10 <= N <= 100) colored lamps numbered from 1 toN.The lamps are connected to four buttons:Butto...
2012-09-02 21:02:00
143
转载 USACO Section 2.2 Subset Sums(整数划分01背包思想)
Subset SumsJRMFor many sets of consecutive integers from 1 through N (1 <= N <= 39), one can partition the set into two sets whose sums are identical.For example, if N=3, one can partit...
2012-09-01 11:29:00
152
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人