ural 1869】的更多相关文章

简单题 ~~ #include <cstdio> #include <cstring> #include <iostream> using namespace std; int a[110][110], _max; void cood(int n) { int sum = 0; for(int i = 1; i <= n; i ++) { for(int j = 1; j < i; j ++) sum -= a[j][i]; for(int j = i+1;…
这是郑州轻工业学校的一次校赛的校内选拔赛,看名字是计算几何 的题 题目地址: http://acm.zzuli.edu.cn/zzuliacm/problem.php?id=1869 Description 给你一个n,求方程 2x + y + 2z = n 解的个数,其中x, y, z, n 都是非负整数 **********************以下是我的思路******************************** 最开始的时候,我是想要用双重循环来做.枚举  x  和  y ,结…
题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串中心位置,RMQ询问LCP = min (height[rank[l]+1] to height[rank[r]]),注意的是RMQ传入参数最好是后缀的位置,因为它们在树上的顺序未知,且左边还要+1. #include <cstdio> #include <algorithm> #in…
2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and each orders a juice cocktail. It could be from 1 to 3 different juices in each cocktail. There are three juices in the bar: apple, banana and pineappl…
2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best programmer in the world! Now he regularly takes part in various programming contests, attentively listens to problems analysis and upsolves problems. But…
2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate integers together in their spare time. Nikolay thinks an integer is interesting if it is a prime number. However, Asya thinks an integer is interesting i…
2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock band on Earth. Band decided to make the most awesome music video ever for their new single. In that music video Ilya will go through Manhattan standi…
2068. Game of Nuts Time limit: 1.0 secondMemory limit: 64 MB The war for Westeros is still in process, manpower and supplies are coming to an end and the winter is as near as never before. The game of thrones is unpredictable so Daenerys and Stannis…
2067. Friends and Berries Time limit: 2.0 secondMemory limit: 64 MB There is a group of n children. According to a proverb, every man to his own taste. So the children value strawberries and raspberries differently. Let’s say that i-th child rates hi…
2066. Simple Expression Time limit: 1.0 secondMemory limit: 64 MB You probably know that Alex is a very serious mathematician and he likes to solve serious problems. This is another problem from Alex. You are given three nonnegative integers a, b, c.…
2065. Different Sums Time limit: 1.0 secondMemory limit: 64 MB Alex is a very serious mathematician and he likes to solve serious problems. For example, this problem. You are to construct an array of n integers in which the amount of different intege…
2064. Caterpillars Time limit: 3.0 secondMemory limit: 64 MB Young gardener didn’t visit his garden for a long time, and now it’s not very pleasant there: ncaterpillars have appeared on the ground. Kirill decided to use this opportunity to have some…
2063. Black and White Time limit: 1.0 secondMemory limit: 64 MB Let’s play a game. You are given a row of n balls, each ball is either black or white. Their positions in a row are numbered from 1 to n. You know the total number of balls n, but have n…
2062. Ambitious Experiment Time limit: 3.0 secondMemory limit: 128 MB During several decades, scientists from planet Nibiru are working to create an engine that would allow spacecrafts to fall into hyperspace and move there with superluminal velocity…
1255. Graveyard of the Cosa Nostra Time limit: 1.0 secondMemory limit: 64 MB There is a custom among the Ural Mafiosi — a big Mafioso’s coffin is to be carried by all his subordinates. The length of the coffin (in meters) equals to the number of the…
1252. Sorting the Tombstones Time limit: 1.0 secondMemory limit: 64 MB There is time to throw stones and there is time to sort stones… An old desolate cemetery is a long dismal row of nameless tombstones There are N tombstones of various shapes. The…
1251. Cemetery Manager Time limit: 1.0 secondMemory limit: 64 MB There is a tradition at the USU championships to call the most hard-to-solve problems coffins. But to distribute coffins is also a very difficult problem. Consider a cemetery with place…
1250. Sea Burial Time limit: 1.0 secondMemory limit: 64 MB There is Archipelago in the middle of a shoreless ocean. An ancient tribe of cannibals lives there. Shamans of this race have been communicating with gods and admonishing people for ages. The…
1249. Ancient Necropolis Time limit: 5.0 secondMemory limit: 4 MB Aerophotography data provide a bitmap picture of a hard-to-reach region. According to the suggestions of scientists, this region is a cemetery of an extinct civilization. Indeed, the p…
1075. Thread in a Space Time limit: 1.0 secondMemory limit: 64 MB There are three points in a 3-dimensional space: A, B and C. All the coordinates of the points are integer numbers with absolute values not greater than 1000. A solid ball with a cente…
1073. Square Country Time limit: 1.0 secondMemory limit: 64 MB There live square people in a square country. Everything in this country is square also. Thus, the Square Parliament has passed a law about a land. According to the law each citizen of th…
1072. Routing Time limit: 1.0 secondMemory limit: 64 MB There is a TCP/IP net of several computers. It means that: Each computer has one or more net interfaces. Each interface is identified by its IP-address and a subnet mask — these are two four-byt…
1071. Nikifor 2 Time limit: 1.0 secondMemory limit: 64 MB Nikifor has a number x. He doesn't need it. He needs a number y. Nikifor tries to obtain the required number by erasing some digits from x. But he is not lucky in the meanwhile. May be he is t…
1070. Local Time Time limit: 1.0 secondMemory limit: 64 MB Soon the USU team will go to Vancouver to participate in the final of the ACM International Collegiate Programming Contest. They will be to take four different planes (three changes on the wa…
1069. Prufer Code Time limit: 0.25 secondMemory limit: 8 MB A tree (i.e. a connected graph without cycles) with vertices is given (N ≥ 2). Vertices of the tree are numbered by the integers 1,…,N. A Prufer code for the tree is built as follows: a leaf…
1339. Babies Time limit: 1.0 secondMemory limit: 64 MB O tempora! O mores! Present-day babies progress quickly. There are exactly k boys and k girls in the kindergarten. Some boys like some girls. But in this age the boys are still knights, so, if so…
HDU 1869六度分离 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Description 1967年,美国著名的社会学家斯坦利·米尔格兰姆提出了一个名为“小世界现象(small world phenomenon)”的著名假说,大意是说,任何2个素不相识的人中间最多只隔着6个人,即只用6个人就可以将他们联系在一起,因此他的理论也被称为“六度分离”理论(six degrees of se…
题目链接 以前做过的一题,URAL数据强点,优化了一下. #include <iostream> #include <cstdio> #include <cstring> #include <queue> #include <map> #include <ctime> #include <cmath> #include <algorithm> using namespace std; ][]; int dfs(…
题目链接 隔了一年零三个月,重新刷URAL,这题挺麻烦的输出路径.输出路径挺扯的,乱写了写乱改改就A了...我本来想用很靠谱,记录每一条路径的,然后输出最小的,结果Tle,然后我使劲水水又过了一组,发现别人的题解..直接来了一次 就过了..我乱搞了搞,倒着记录最小的,然后倒着输出,就过了... #include <cstring> #include <cstdio> #include <string> #include <iostream> #include…
URAL 1001.  A + B 1002.  简单题,开方计算! 1003.…