随笔分类 -  USCAO

摘要:Fence LoopsThe fences that surround Farmer Brown's collection of pastures have gotten out of control. They are made up of straight segments from 1 through 200 feet long that join together only at their endpoints though sometimes more than two fences join together at a given endpoint. The result 阅读全文
posted @ 2013-07-08 19:32 剑不飞 阅读(204) 评论(0) 推荐(0)
摘要: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 he's having a problem with the rails. The local lumber store has dropped off boards of varying lengths; 阅读全文
posted @ 2013-04-08 21:07 剑不飞 阅读(528) 评论(0) 推荐(0)
摘要:Closed FencesA closed fence in the plane is a set of non-crossing, connected line segments with N corners (3 #include #include #include using namespace std; const double ex=1e-10; const int mm=2100; class _point { public:double x,y; _point(double xx,double yy){x=xx;y=yy;} _point(){} }; class ... 阅读全文
posted @ 2013-03-19 10:50 剑不飞 阅读(368) 评论(0) 推荐(0)
摘要:Raucous RockersYou just inherited the rights to N (1 #include using namespace std; ifstream cin("rockers.in"); ofstream cout("rockers.out"); const int mm=33; class node { public:int t,c; node(){t=c=0;} }dp[mm][mm]; int n,t,m; int s[mm]; int main() { while(cin>>n>>t> 阅读全文
posted @ 2013-03-13 17:34 剑不飞 阅读(498) 评论(0) 推荐(0)
摘要: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 them in graphic form, he records them in the more linear `tree in-order' and `tree pre-order' notation 阅读全文
posted @ 2013-03-07 15:58 剑不飞 阅读(338) 评论(0) 推荐(0)
摘要:A GameIOI'96 - Day 1 Consider the following two-player game played with a sequence of N positive integers (2 #include using namespace std; ifstream cin("game1.in"); ofstream cout("game1.out"); const int mm=1000; int f[mm][mm],sum[mm][mm]; int shu[mm]; int main() { int n; whil 阅读全文
posted @ 2013-01-07 20:32 剑不飞 阅读(304) 评论(0) 推荐(0)
摘要:Home on the RangeFarmer John grazes his cows on a large, square field N (2 = 2x2) remaining. Of course, grazing areas may overlap for purposes of this report.PROGRAM NAME: rangeINPUT FORMATLine 1:N, the number of miles on each side of the field.Line 2..N+1:N characters with no spaces. 0 represents & 阅读全文
posted @ 2013-01-06 11:52 剑不飞 阅读(198) 评论(0) 推荐(0)
摘要:CamelotIOI 98 Centuries 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 board game for one player, on which one chesspiece king and several knight pieces are placed on squar 阅读全文
posted @ 2013-01-05 14:31 剑不飞 阅读(461) 评论(0) 推荐(0)
摘要:Shopping OffersIOI'95 In 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 customers, the shop introduces some special offers.A special offer consists of one or more product item 阅读全文
posted @ 2012-11-12 19:57 剑不飞 阅读(185) 评论(0) 推荐(0)
摘要: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 the broken parts.Farmer John is as lazy as the next farmer and hates to ride the same fence twice. Your 阅读全文
posted @ 2012-11-05 16:13 剑不飞 阅读(390) 评论(0) 推荐(0)
摘要: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 #include #include #include using namespace std; ifstream cin("butter.in"); ofstream cout("but 阅读全文
posted @ 2012-11-04 13:04 剑不飞 阅读(293) 评论(0) 推荐(0)
摘要:Magic SquaresIOI'96 Following 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:12348765In this task we consider the version where each square has a different color. Colors are denoted by the first 8 posi 阅读全文
posted @ 2012-11-03 13:58 剑不飞 阅读(359) 评论(0) 推荐(0)
摘要:Feed Ratios1998 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 these easily mixable grains, he can not buy that mixture! He buys three other mixtures of the three grains 阅读全文
posted @ 2012-11-03 11:18 剑不飞 阅读(317) 评论(0) 推荐(0)
摘要:Spinning Wheels1998 ACM NE Regionals Each 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 alignment mark (at 0 degrees) so that the wheels can all be started in a known position. Wheels rotate in t 阅读全文
posted @ 2012-11-02 20:17 剑不飞 阅读(394) 评论(0) 推荐(0)
摘要:StringsobitsKim Schrijvers Consider an ordered set S of strings of N (1 15说明4位装不下,不到19个那么第5位一定得是1, 即是1xxxx(x代表未知)假设m为输入的I,m原先等于19,当第5位确定为1后m=m-15=4;那原题转化为求42 4的输出只要求出4 2 4的输出,也就是求1xxxx 后面的四个x;同样的3位可选2个1,1个1,0个1 有7>4;也就是说3位可以装的下那第四位就为0,原题转化为求3, 2 4的输出即是求10XXX后面的三个未知数,重复操作 直到m化为0,得到结果。注意点:31位,貌似int 阅读全文
posted @ 2012-10-24 16:58 剑不飞 阅读(263) 评论(0) 推荐(0)