随笔分类 -  ACM(C/C++)

TJU 2468 Counting Letters
摘要:2468 Counting LettersAs a talented student, your boss gave you a task. Given a text string, you should find out which letters appear most frequently.Really simple, isn't it?InputThe first line of the input is the number of test cases. Then some test cases followed.Each test cas... 阅读全文
posted @ 2012-08-27 20:49 Stephen Li 阅读(1368) 评论(0) 推荐(0)
POJ 1837 Balance(01背包应用)
摘要:BalanceTime Limit:1000MSMemory Limit:30000KTotal Submissions:6667Accepted:4013DescriptionGigel has a strange "balance" and he wants to poise it. Actually, the device is different from any other ordinary balance.It orders two arms of negligible weight and each arm's length is 15. Some h 阅读全文
posted @ 2012-05-14 21:32 Stephen Li 阅读(328) 评论(0) 推荐(0)
POJ 2526 Center of symmetry(计算几何--对称点)
摘要:Center of symmetryTime Limit:1000MSMemory Limit:65536KTotal Submissions:2190Accepted:972Description Given is a set of n points with integer coordinates. Your task is to decide whether the set has a center of symmetry.A set of points S has the center of symmetry if there exists a point s (notnecessar 阅读全文
posted @ 2012-05-11 20:47 Stephen Li 阅读(545) 评论(0) 推荐(0)
POJ 3673 Cow Multiplication(简单数学)
摘要:Cow MultiplicationTime Limit:1000MSMemory Limit:65536KTotal Submissions:9717Accepted:6574DescriptionBessie is tired of multiplying pairs of numbers the usual way, so she invented her own style of multiplication. In her style,A*Bis equal to the sum of all possible pairwise products between the digits 阅读全文
posted @ 2012-05-10 22:09 Stephen Li 阅读(339) 评论(0) 推荐(0)
POJ 3616 Milking Time(简单DP)
摘要:Milking TimeTime Limit:1000MSMemory Limit:65536KTotal Submissions:3055Accepted:1281DescriptionBessie is such a hard-working cow. In fact, she is so focused on maximizing her productivity that she decides to schedule her nextN(1 ≤N≤ 1,000,000) hours (conveniently labeled 0..N-1) so that she produces 阅读全文
posted @ 2012-05-10 21:53 Stephen Li 阅读(486) 评论(0) 推荐(0)
计算几何模板(一)
摘要:这两周一直在做计算几何的题,感觉计算几何题就是读懂题意,并且能有清晰的解题思路,剩下的就是套用模板了,所以模板相当重要!下面整理了一些模板以便以后做题用说明:下面的eps 都是1e-8;目录:㈠ Pick定理:㈡ 在二维空间中,已知四个点的坐标,求交点的坐标㈢ 已知多边形的顶点的坐标,求多边形的面积利用叉积㈣ 求三角形面积㈤ 判断一个多边形是否是一个凸包㈥ 求凸包的周长(在若干个点钟选取点组成凸包并求其周长)㈦ 判断点是否在凸包内㈧ 凸包内的点到凸包每条边的距离㈨ 跨立试验--判断两条线段是否相交(含顶点)㈩ 判断点是否在矩形的内部①.Pick定理:如图给定顶点坐标都是整点,所围成的多边形的面 阅读全文
posted @ 2012-05-09 21:32 Stephen Li 阅读(723) 评论(0) 推荐(0)
POJ 1039 Pipe(计算几何---直线和线段的相交问题)
摘要:PipeTime Limit:1000MSMemory Limit:10000KTotal Submissions:6888Accepted:2020DescriptionThe GX Light Pipeline Company started to prepare bent pipes for the new transgalactic light pipeline. During the design phase of the new pipe shape the company ran into the problem of determining how far the light 阅读全文
posted @ 2012-05-08 21:55 Stephen Li 阅读(383) 评论(0) 推荐(0)
POJ 2007 Scrambled Polygon(计算几何---凸包)
摘要:Scrambled PolygonTime Limit:1000MSMemory Limit:30000KTotal Submissions:4906Accepted:2327DescriptionA closed polygon is a figure bounded by a finite number of line segments. The intersections of the bounding line segments are called the vertices of the polygon. When one starts at any vertex of a clos 阅读全文
posted @ 2012-05-07 11:19 Stephen Li 阅读(383) 评论(0) 推荐(0)
POJ 3664 Election Time(简单的快速排序)
摘要:Election TimeTime Limit:1000MSMemory Limit:65536KTotal Submissions:5420Accepted:2944DescriptionThe cows are having their first election after overthrowing the tyrannical Farmer John, and Bessie is one ofNcows (1 ≤N≤ 50,000) running for President. Before the election actually happens, however, Bessie 阅读全文
posted @ 2012-05-07 10:32 Stephen Li 阅读(884) 评论(0) 推荐(0)
POJ 1410 Intersection(计算几何---线段相交--跨立试验)
摘要:IntersectionTime Limit:1000MSMemory Limit:10000KTotal Submissions:7609Accepted:1989DescriptionYou are to write a program that has to decide whether a given line segment intersects a given rectangle.An example:line: start point: (4,9)end point: (11,2)rectangle: left-top: (1,5)right-bottom: (7,1)Figur 阅读全文
posted @ 2012-05-06 21:37 Stephen Li 阅读(1135) 评论(0) 推荐(0)
POJ 2954 Triangle(计算几何---Pick定理)
摘要:TriangleTime Limit:1000MSMemory Limit:65536KTotal Submissions:3627Accepted:1586DescriptionAlattice pointis an ordered pair (x,y) wherexandyare both integers. Given the coordinates of the vertices of a triangle (which happen to be lattice points), you are to count the number of lattice points which l 阅读全文
posted @ 2012-05-06 19:58 Stephen Li 阅读(406) 评论(0) 推荐(0)
POJ 3663 Costume Party (快速排序)
摘要:Costume PartyTime Limit:1000MSMemory Limit:65536KTotal Submissions:9132Accepted:3552DescriptionIt's Halloween! Farmer John is taking the cows to a costume party, but unfortunately he only has one costume. The costume fits precisely two cows with a length ofS(1 ≤S≤ 1,000,000). FJ hasNcows (2 ≤N≤ 阅读全文
posted @ 2012-05-06 17:47 Stephen Li 阅读(812) 评论(0) 推荐(0)
POJ 2187 Beauty Contest(计算几何-- 凸包)
摘要:Beauty ContestTime Limit:3000MSMemory Limit:65536KTotal Submissions:19373Accepted:5850DescriptionBessie, Farmer John's prize cow, has just won first place in a bovine beauty contest, earning the title 'Miss Cow World'. As a result, Bessie will make a tour of N (2 <= N <= 50,000) fa 阅读全文
posted @ 2012-05-06 17:12 Stephen Li 阅读(295) 评论(0) 推荐(0)
POJ 1113 Wall(计算几何--凸包的周长)
摘要:WallTime Limit:1000MSMemory Limit:10000KTotal Submissions:21731Accepted:7132DescriptionOnce upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he would not listen to his Architect's proposals to build a b 阅读全文
posted @ 2012-05-06 16:12 Stephen Li 阅读(295) 评论(0) 推荐(0)
POJ 1584 A Round Peg in a Ground Hole(计算几何--凸包)
摘要:A Round Peg in a Ground HoleTime Limit:1000MSMemory Limit:10000KTotal Submissions:3574Accepted:1051DescriptionThe DIY Furniture company specializes in assemble-it-yourself furniture kits. Typically, the pieces of wood are attached to one another using a wooden peg that fits into pre-cut holes in eac 阅读全文
posted @ 2012-05-04 20:28 Stephen Li 阅读(259) 评论(0) 推荐(0)
POJ 1408 Fishnet(几何--叉积求面积 + 求直线的交点坐标)
摘要:FishnetTime Limit:1000MSMemory Limit:10000KTotal Submissions:1302Accepted:824DescriptionA fisherman named Etadokah awoke in a very small island. He could see calm, beautiful and blue sea around the island. The previous night he had encountered a terrible storm and had reached this uninhabited island 阅读全文
posted @ 2012-05-03 21:04 Stephen Li 阅读(492) 评论(0) 推荐(0)
POJ 2031 Building a Space Station(三维空间中最小生成树Prim算法)
摘要:Building a Space StationTime Limit:1000MSMemory Limit:30000KTotal Submissions:2585Accepted:1362DescriptionYou are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write a computer program to complete the task.The 阅读全文
posted @ 2012-05-03 19:01 Stephen Li 阅读(364) 评论(0) 推荐(0)
POJ 1265 Area(计算几何Pick定理)
摘要:AreaTime Limit:1000MSMemory Limit:10000KTotal Submissions:3131Accepted:1486DescriptionBeing well known for its highly innovative products, Merck would definitely be a good target for industrial espionage. To protect its brand-new research and development facility the company has installed the latest 阅读全文
posted @ 2012-05-03 17:06 Stephen Li 阅读(264) 评论(0) 推荐(0)
NYOJ 303 序号互换(规律)---河南第四届ACM省赛
摘要:序号互换时间限制:1000ms | 内存限制:65535KB难度:2描述Dr.Kong设计了一个聪明的机器人卡多,卡多会对电子表格中的单元格坐标快速计算出来。单元格的行坐标是由数字编号的数字序号,而列坐标使用字母序号。观察字母序号,发现第1列到第26列的字母序号分别为A,B,…,Z,接着,第27列序号为AA,第28列为AB,依此类推。若给Dr.Kong的机器人卡多一个数字序号(比如32),它能很快算出等价的字母序号(即AF),若给机器人一个字母序号(比如AA)),它也能很快算出等价的数字序号(27),你能不能与卡多比试比试,看谁能算得更快更准确。输入第一行: N 表示有多少组测试数据。接下来有 阅读全文
posted @ 2012-04-24 23:27 Stephen Li 阅读(365) 评论(0) 推荐(0)
HDU 1864 最大报销额(01背包应用)
摘要:最大报销额Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9752Accepted Submission(s): 2603Problem Description现有一笔经费可以报销一定额度的发票。允许报销的发票类型包括买图书(A类)、文具(B类)、差旅(C类),要求每张发票的总额不得超过1000元,每张发票上,单项物品的价值不得超过600元。现请你编写程序,在给出的一堆发票中找出可以报销的、不超过给定额度的最大报销额。Input测试输入包含若干 阅读全文
posted @ 2012-04-24 21:41 Stephen Li 阅读(684) 评论(0) 推荐(0)