随笔分类 -  ACM-模板

摘要: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 counter-clockwise order in an array {xi, yi}, i in (1..N).Every pair of adjacent vertices defines a side of the f 阅读全文
posted @ 2012-09-21 09:43 mtry 阅读(690) 评论(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-09-18 10:41 mtry 阅读(3335) 评论(0) 推荐(0)
摘要:InformationTime Limit:2 Seconds Memory Limit:32768 KBIt is a war between Country Alpha and Country Beta. Country Alpha gets following information about Country Beta:Country Beta has n (2 <= n <= 100) cities numbered from 0 to n-1. Each city has a transmitter and a receiver. One city is able to 阅读全文
posted @ 2012-08-06 10:43 mtry 阅读(422) 评论(0) 推荐(0)
摘要:DividingTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8755Accepted Submission(s): 2374Problem DescriptionMarsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equal share of the ma 阅读全文
posted @ 2012-08-01 20:45 mtry 阅读(2366) 评论(0) 推荐(0)
摘要:奔小康赚大钱Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 822Accepted Submission(s): 379Problem Description传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家老百姓,考虑到每家都要有房住(如果有老百姓没房子住的话,容易引起不安定因素),每家必须分配到一间房子且只能得到一间房子。另一方面,村长和另外 阅读全文
posted @ 2012-07-25 22:01 mtry 阅读(248) 评论(0) 推荐(0)
摘要:过山车Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4754Accepted Submission(s): 2056Problem DescriptionRPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各自的想法,举个例子把,Rabbit只愿意和XHD或PQK做partner,Grass只 阅读全文
posted @ 2012-07-24 21:13 mtry 阅读(272) 评论(0) 推荐(0)
摘要:方格取数(2)Time Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2580Accepted Submission(s): 777Problem Description给你一个m*n的格子的棋盘,每个格子里面有一个非负数。从中取出若干个数,使得任意的两个数所在的格子没有公共边,就是说所取数所在的2个格子不能相邻,并且取出的数的和最大。Input包括多个测试实例,每个测试实例包括2整数m,n和m*n个非负数(m<=50,n<=50)Out 阅读全文
posted @ 2012-07-18 23:35 mtry 阅读(787) 评论(0) 推荐(0)
摘要:方格取数(1)Time Limit: 1000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2076Accepted Submission(s): 792Problem Description给你一个n*n的格子的棋盘,每个格子里面有一个非负数。从中取出若干个数,使得任意的两个数所在的格子没有公共边,就是说所取的数所在的2个格子不能相邻,并且取出的数的和最大。Input包括多个测试实例,每个测试实例包括一个整数n 和n*n个非负数(n<=20)Output对于每个测试 阅读全文
posted @ 2012-07-18 23:30 mtry 阅读(1314) 评论(0) 推荐(0)
摘要:最短路Problem Description在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input输入包括多组数据。每组数据第一行是两个整数N、M(N<=100,M<=10000),N表示成都的大街上有几个路口,标号为1的路口是商店所在地,标号为N的路口是赛场所在地,M则表示在成都有几条路。N=M=0表示输入结束。接下来M行,每行包括3个整数A,B,C(1<=A,B<=N,1<=C<=1000), 阅读全文
posted @ 2012-07-15 00:00 mtry 阅读(426) 评论(0) 推荐(0)
摘要:Schedule ProblemTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 641Accepted Submission(s): 245Special JudgeProblem DescriptionA project can be divided into several parts. Each part should be completed continuously. This means if a part should take 阅读全文
posted @ 2012-07-13 22:15 mtry 阅读(745) 评论(0) 推荐(1)
摘要:1024: MiningTime Limit: 1 SecMemory Limit: 128 MBSUBMIT: 14Solved: 4[SUBMIT][STATUS]DescriptionZfy and Kevin are friends and they like to go mining together at some place in the university. About at 6 p.m. they start to feel tired and want to go to dormitory. They want to get to dormitory quickly so 阅读全文
posted @ 2012-05-17 13:49 mtry 阅读(312) 评论(0) 推荐(0)
摘要:Minimum Inversion NumberTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3466Accepted Submission(s): 2113Problem DescriptionThe inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i < j and ai 阅读全文
posted @ 2012-05-16 09:00 mtry 阅读(567) 评论(0) 推荐(0)
摘要:I Hate ItTime Limit: 9000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 14377Accepted Submission(s): 5570Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个 阅读全文
posted @ 2012-05-14 18:45 mtry 阅读(254) 评论(0) 推荐(0)
摘要:Hat's FibonacciTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3442Accepted Submission(s): 1169Problem DescriptionA Fibonacci sequence is calculated by adding the previous two members the sequence, with the first two members being both 1.F(1) = 阅读全文
posted @ 2012-05-07 11:37 mtry 阅读(818) 评论(0) 推荐(0)
摘要:A + B Problem IITime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 111273Accepted Submission(s): 21079Problem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.InputThe first line of 阅读全文
posted @ 2012-05-07 09:44 mtry 阅读(2357) 评论(0) 推荐(0)
摘要:还是畅通工程Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12633Accepted Submission(s): 5811Problem Description某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。Input测试输入包含若干测试用例。每个测试用 阅读全文
posted @ 2012-05-04 21:12 mtry 阅读(328) 评论(0) 推荐(0)
摘要:Game of Connections时间限制:1000 ms | 内存限制:65535 KB难度:3描述This is a small but ancient game. You are supposed to write down the numbers 1, 2, 3, . . . , 2n - 1, 2n consecutively in clockwise order on the ground to form a circle, and then, to draw some straight line segments to connect them into number pai 阅读全文
posted @ 2012-03-30 16:40 mtry 阅读(1416) 评论(0) 推荐(0)
摘要:次方求模时间限制:1000 ms | 内存限制:65535 KB难度:3描述求a的b次方对c取余的值输入第一行输入一个整数n表示测试数据的组数(n<100)每组测试只有一行,其中有三个正整数a,b,c(1=<a,b,c<=1000000000)输出输出a的b次方对c取余之后的结果样例输入32 3 53 100 1011 12345 12345样例输出3110481心得:这题wa好多次了,找了好久多没发现错误,long long 2^63 大概是 9*10^18,假如999999999*999999999*999999999肯定超过int 64位的长度了,所以一定溢出。测试案例 阅读全文
posted @ 2012-03-19 14:53 mtry 阅读(466) 评论(0) 推荐(0)
摘要:第一行输入一个整数n,第二行接下来n个整数,互不相同,第三行输入一个整数m<=n;接下来m行每行一个整数为要删除的整数都是上面出现过的整数。View Code /*其中没有相同的元素*/#include<iostream>using namespace std;typedef struct findtree{ int date; int v;//以v为根更有多少节点 struct findtree *left,*right,*pre; struct findtree() { v=1; left=right=NULL; }}find... 阅读全文
posted @ 2011-11-17 14:35 mtry 阅读(383) 评论(0) 推荐(0)
摘要:树的判定时间限制:1000 ms | 内存限制:65535 KB难度:4描述A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following properties.There is exactly one node, called the root, to which no directed edges 阅读全文
posted @ 2011-10-25 20:46 mtry 阅读(616) 评论(0) 推荐(0)