In mathematics, a polygonal number is a number represented as dots or pebbles arranged in the shape of a regular polygon. The dots are thought of as alphas (units). These are one type of 2-dimensional figurate numbers. The following picture shows how triangular numbers, square numbers, pentagonal numbers and hexagonal numbers represented as dots arranged in the shape of corresponding regular polygon.
Polygonal Numbers: Triangular, Square, Pentagonal and Hexagonal numbers
2016 is not only a leap year but also a triangular and hexagonal year. If you are patient enough, you can count the number of the dots in the left triangle or in the right hexagon in the following picture. The number of dots in each shape is 2016.
2016 is a triangular-hexagonal-leap year
Therefore, 2016 is a triangular-hexagonal-leap year. The previous triangular-hexagonal-leap year is 1540 and the next is 2556. So living to see 2016 is very rare experience.
You task is to list the triangular-hexagonal-leap years from 2016 to 990528. 990528 is also a triangular-hexagonal-leap year.
This problem has no input.
Please print each triangular-hexagonal-leap year in increasing order.
For example, if you are asked to list the triangular-hexagonal-leap years from 780 to 2556, the output should be:
... <-- some lines are skipped
私信点赞 评论 复制链接分享
- 5年前回答 1 已采纳 Description In mathematics, a polygonal number is a number represented as dots or pebbles arranged in the shape of a regular polygon. The dots are thought of as alphas (units). These are one type of 2-dimensional figurate numbers. The following picture shows how triangular numbers, square numbers, pentagonal numbers and hexagonal numbers represented as dots arranged in the shape of corresponding regular polygon. Polygonal Numbers: Triangular, Square, Pentagonal and Hexagonal numbers 2016 is not only a leap year but also a triangular and hexagonal year. If you are patient enough, you can count the number of the dots in the left triangle or in the right hexagon in the following picture. The number of dots in each shape is 2016. 2016 is a triangular-hexagonal-leap year Therefore, 2016 is a triangular-hexagonal-leap year. The previous triangular-hexagonal-leap year is 1540 and the next is 2556. So living to see 2016 is very rare experience. You task is to list the triangular-hexagonal-leap years from 2016 to 990528. 990528 is also a triangular-hexagonal-leap year. Input This problem has no input. Output Please print each triangular-hexagonal-leap year in increasing order. For example, if you are asked to list the triangular-hexagonal-leap years from 780 to 2556, the output should be: 780 1128 1540 2016 2556 Sample Output 2016 2556 ... <-- some lines are skipped 990528
- 4年前回答 2 已采纳 Problem Description You're given an unlimited number of pebbles to distribute across an N x N game board (N drawn from [3, 15]), where each square on the board contains some positive point value between 10 and 99, inclusive. A 6 x 6 board might look like this: The player distributes pebbles across the board so that: ?At most one pebble resides in any given square. ?No two pebbles are placed on adjacent squares. Two squares are considered adjacent if they are horizontal, vertical, or even diagonal neighbors. There's no board wrap, so 44 and 61 of row three aren't neighbors. Neither are 33 and 75 nor 55 and 92. The goal is to maximize the number of points claimed by your placement of pebbles. Write a program that reads in a sequence of boards from an input file and prints to stdout the maximum number of points attainable by an optimal pebble placement for each. Input Each board is expressed as a series of lines, where each line is a space-delimited series of numbers. A blank line marks the end of each board (including the last one) Output then your program would print the maximum number of points one can get by optimally distributing pebbles while respecting the two rules, which would be this (each output should be printed on a single line and followed with a newline): Sample Input 71 24 95 56 54 85 50 74 94 28 92 96 23 71 10 23 61 31 30 46 64 33 32 95 89 78 78 11 55 20 11 98 54 81 43 39 97 12 15 79 99 58 10 13 79 83 65 34 17 85 59 61 12 58 97 40 63 97 85 66 90 33 49 78 79 30 16 34 88 54 39 26 80 21 32 71 89 63 39 52 90 14 89 49 66 33 19 45 61 31 29 84 98 58 36 53 35 33 88 90 19 23 76 23 76 77 27 25 42 70 36 35 91 17 79 43 33 85 33 59 47 46 63 75 98 96 55 75 88 10 57 85 71 34 10 59 84 45 29 34 43 46 75 28 47 63 48 16 19 62 57 91 85 89 70 80 30 19 38 14 61 35 36 20 38 18 89 64 63 88 83 45 46 89 53 83 59 48 45 87 98 21 15 95 24 35 79 35 55 66 91 95 86 87 94 15 84 42 88 83 64 50 22 99 13 32 85 12 43 39 41 23 35 97 54 98 18 85 84 61 77 96 49 38 75 95 16 71 22 14 18 72 97 94 43 18 59 78 33 80 68 59 26 94 78 87 78 92 59 83 26 88 91 91 34 84 53 98 83 49 60 11 55 17 51 75 29 80 14 79 15 18 94 39 69 24 93 41 66 64 88 82 21 56 16 41 57 74 51 79 49 15 59 21 37 27 78 41 38 82 19 62 54 91 47 29 38 67 52 92 81 99 11 27 31 62 32 97 42 93 43 79 88 44 54 48 Sample Output 572 683 2096 2755
- 回答 1 已采纳 Description A polygonal number is a number which can be represented by a regular geometrical arrangement of equally spaced points, where the arrangement forms a regular polygon. Some examples are shown in the figure below. !(http://poj.org/images/1640_1.jpg) The first figure shows the first 4 triangular numbers 1, 3, 6, 10. The next three show the first four square, pentagonal and hexagonal numbers, respectively. In general, k-gonal numbers are those whose points define a regular k-gon (hence triangular numbers are 3-gonal, square numbers are 4-gonal, etc.).We will define k as an index of the polygonal number. For this problem, you are to find numbers which are k-gonal for two or more values of k. We will call these numbers poly-polygonal. Input Input will consist of multiple problem instances. Each instance will consist of 3 lines. The first line will be a non-negative integer n <= 50 indicating the number of types of polygonal numbers of interest in this problem. Note that this line may be longer than 80 characters. The next line will contain n integers indicating the indices of these polygonal numbers (all distinct and in increasing order). For example, if the first line contained the value 3, and the next line contained the values 3 6 10, then that problem instance would be interested in 3-gonal, 6-gonal and 10-gonal numbers. Each index k will lie in the range 3 <= k <= 1000. The last line of the problem instance will consist of a single positive integer s <= 10000, which serves as a starting point for the search for poly-polygonal numbers. A value of n = 0 terminates the input. Output For each problem instance, you should output the next 5 poly-polygonal numbers which are greater than or equal to s. Each number should be on a single line and conform to the following format: num:k1 k2 k3 ... where num is the poly-polygonal number, and k1, k2, k3 ... are the indices (in increasing order) of the poly-polygonal number equal to num. A single space should separate each index, and you should separate each problem instance with a single blank line. The judges input will be such that the maximum value for any poly-polygonal number will fit in a long variable. Sample Input 10 6 7 8 9 10 11 12 13 14 15 1000 5 3 4 13 36 124 1 0 Sample Output 1216:9 12 1540:6 10 1701:10 13 2300:11 14 3025:12 15 1:3 4 13 36 124 36:3 4 13 36 105:3 36 171:3 13 1225:3 4 124
- 回答 1 已采纳 You are going to read a sequence of pairs of integer numbers. Each pair represents the Cartesian coordinates of a point in a 2-dimentional plane. The first number is the x coordinate, while the second is that of y. The sequence represents a polygonal line. Your task is to draw a rectangle with minimal length of sides that exactly surrounds the polygonal line. The sides of the rectangle are parallel to x- and y-axis, respectively. Input Input consists of several test cases. For each case, a sequence of coordinates is given. Each pair of x and y occupies a line, with |x| and |y| less than 2^31. The sequence is terminated with a pair of 0's. Note that (0, 0) will never be considered as a point on any of the polygonal lines. An empty polygonal line signals the end of input. Output For each test case, print in one line two pairs of numbers, which are the south-west and north-east corners of the surrounding rectangle. The numbers must be separated by one space as is indicated in the samples. Sample Input 12 56 23 56 13 10 0 0 12 34 0 0 0 0 Sample Output 12 10 23 56 12 34 12 34
- 4年前回答 1 已采纳 A mountainous region had many forest fires in the dry season of the last year. Prior to the dry season of this year, to watch the forest fire, you are planning to construct a fire tower which enables us to watch all mountain slopes. To minimize the construction cost, you want to minimize the height of the fire tower. A polyhedral terrain can be thought of as the surface of a mountain range with flat faces and with no curves or overhangs. In this problem, we consider only the 2-dimensional case, which simplifies the polyhedral terrain into a 2-dimensional polygonal chain in the plane. This polygonal chain is represented by n consecutive vertices v1, v2, ..., vn that are given by increasing order of x-coordinate of the vertices and n - 1 edges which connect two adjacent vertices vi and vi + 1 for 1 <= i <= n - 1. Following figure shows the minimum height fire tower of a polygonal chain. Your task is to compute the minimum height of the fire tower on a polygonal chain such that every point on the polygonal chain is visible from the top of the fire tower. Note that the fire tower can be placed on a vertex or an edge of the polygonal chain. You can assume that there are no cases where the minimum height of the fire tower is zero. Input Your program is to read from standard input. The input consists of Ttest cases. The number of test cases T is given in the first line of the input. Each test case starts with a line containing an integer n, the number of input points, 4 <= n <= 1,000. In the next n lines, the coordinates of a polygonal chain's vertices are given in increasing order of x-coordinate. Each line contains two positive integers x and y that represent the coordinates of the vertex, 0 <= x, y<= 100,000. Output Your program is to write to standard output. Print exactly one line for each test case. For each test case, print the minimum height of the fire tower that watches the given polygonal chain with rounded one fractional digit. If the height of the fire tower is greater than 1,000 then print IMPOSSIBLE. Sample Input 3 12 1 8 3 11 5 1 7 4 9 3 10 1 12 7 14 4 16 3 19 2 20 13 22 12 11 11 9 16 215 21 9 26 215 31 9 36 1 41 9 46 215 51 9 56 215 61 9 8 7 8 12 18 17 8 27 23 37 23 47 8 52 18 57 8 Sample Output 10.5 IMPOSSIBLE 35.0
- 回答 1 已采纳 Description !(http://poj.org/images/2701_1.jpg) In the sub-tropical Pacific Ocean there is a country consisting of many islands. Its capital, Lapux, is a circular, floating island of radius R0 that always stays in the air at a fixed elevation through some magical application of magnetic forces. There is a very short festival each year at the noon of the summer solstice, when the sun shines directly from above. At this time Lapux moves rapidly over the sea along some polygonal path, casting a shadow right beneath it. (Note: a polygonal path is a path consisting of several straight line segments.) The shadow is enlarged by a circular ring of artificial clouds surrounding Lapux serving some unknown practical and entertainment functions. Because of his predecessors' promise to the people and because of technical reasons, the benign dictator of Lapux always order the engineers to plan for a path and a cloud-controlling scheme such that Lapux and the clouds never cast a shadow on any part of the islands; the size of the circular disc of shadow remain constant along each segment of the polygonal path, changing only at the vertices, i.e., when it changes directions; the size of the shadow be as large as possible, up to the technical limit of radius R1. You are to help the benign dictator of Lapux verifying that the path proposed by the engineers are indeed feasible, and to calculate the radius of the shadow at each segment of the path. In this problem, islands are represented as polygons, and the path of the center of Lapux as a polygonal line. You can safely assume that all islands are convex and that the path always stays on the sea and never touches any island (but may cross itself). Note thak a polygon P is convex if and only if the line segment joining any pair of points in P is completely contained in P. Consider the example above, where R0 = 10 and R1 = 50. The radius of the shadow can assume the minimum value of 50 during the first segment. During the second segment, the center passes (200, 240), which is only 7.07 <= R0 from the northwest corner of an island, and therefore is infeasible. The radius for the third segment is limited by the distance between the last stop and the southern tip of the triangular island, namely 20.0. Input The input consists of several test cases. Each test case begins with a line of 2 real numbers and 1 integer - R0 the minimum radius, R1 the minimum radius, and n, 1 <= n <= 20 the number of islands. Each of the next n lines represents an island. The first number ni, 3 <= n <= 20 on a line gives the number of vertices of this island. The following ni, pairs of real numbers represent the x- and y- coordinates of the vertices around the island. The next line gives the path. The first number m, 2 <= m <= 20 gives the number of vertices of the path. The following m pairs of real numbers represent the x- and y-coordinates of the vertices along the path. The last test case is followed by a line consisting of three zeros. Every real number t in the input file has at most one digit after the decimal point and −9999.9 <= t <= 9999.9. Output Print the result of each test case on one line. For a test case with an mvertex path, print m − 1 integers, in order, each representing the desired radius (rounded to the decimal point) during that segment of flight. If the desired radius is impossible for a segment (less than R0), print '0' for that segment. Round all numbers to integers. Sample Input 10 50 3 3 220.0 360.0 240.0 380.0 200.0 380.0 4 205.0 235.0 240.0 220.0 240.0 200.0 220.0 200.0 4 60.0 340.0 120.0 280.0 180.0 340.0 120.0 400.0 4 20.0 200.0 160.0 200.0 220.0 260.0 220.0 340.0 0 0 0 Sample Output 50 0 20
- 回答 1 已采纳 There are many secret openings in the floor which are covered by a big heavy stone. When the stone is lifted up, a special mechanism detects this and activates poisoned arrows that are shot near the opening. The only possibility is to lift the stone very slowly and carefully. The ACM team must connect a rope to the stone and then lift it using a pulley. Moreover, the stone must be lifted all at once; no side can rise before another. So it is very important to find the centre of gravity and connect the rope exactly to that point. The stone has a polygonal shape and its height is the same throughout the whole polygonal area. Your task is to find the centre of gravity for the given polygon. Input The input consists of T test cases. The number of them (T) is given on the first line of the input. Each test case begins with a line containing a single integer N (3 <= N <= 1000000) indicating the number of points that form the polygon. This is followed by N lines, each containing two integers Xi and Yi (|Xi|, |Yi| <= 20000). These numbers are the coordinates of the i-th point. When we connect the points in the given order, we get a polygon. You may assume that the edges never touch each other (except the neighboring ones) and that they never cross. The area of the polygon is never zero, i.e. it cannot collapse into a single line. Output Print exactly one line for each test case. The line should contain exactly two numbers separated by one space. These numbers are the coordinates of the centre of gravity. Round the coordinates to the nearest number with exactly two digits after the decimal point (0.005 rounds up to 0.01). Note that the centre of gravity may be outside the polygon, if its shape is not convex. If there is such a case in the input data, print the centre anyway. Sample Input 2 4 5 0 0 5 -5 0 0 -5 4 1 1 11 1 11 11 1 11 Sample Output 0.00 0.00 6.00 6.00
- 4年前回答 1 已采纳 Description Once 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 beautiful brick wall with a perfect shape and nice tall towers. Instead, he ordered to build the wall around the whole castle using the least amount of stone and labor, but demanded that the wall should not come closer to the castle than a certain distance. If the King finds that the Architect has used more resources to build the wall than it was absolutely necessary to satisfy those requirements, then the Architect will loose his head. Moreover, he demanded Architect to introduce at once a plan of the wall listing the exact amount of resources that are needed to build the wall. Your task is to help poor Architect to save his head, by writing a program that will find the minimum possible length of the wall that he could build around the castle to satisfy King's requirements. The task is somewhat simplified by the fact, that the King's castle has a polygonal shape and is situated on a flat ground. The Architect has already established a Cartesian coordinate system and has precisely measured the coordinates of all castle's vertices in feet. Input The first line of the input file contains two integer numbers N and L separated by a space. N (3 <= N <= 1000) is the number of vertices in the King's castle, and L (1 <= L <= 1000) is the minimal number of feet that King allows for the wall to come close to the castle. Next N lines describe coordinates of castle's vertices in a clockwise order. Each line contains two integer numbers Xi and Yi separated by a space (-10000 <= Xi, Yi <= 10000) that represent the coordinates of ith vertex. All vertices are different and the sides of the castle do not intersect anywhere except for vertices. Output Write to the output file the single number that represents the minimal possible length of the wall in feet that could be built around the castle to satisfy King's requirements. You must present the integer number of feet to the King, because the floating numbers are not invented yet. However, you must round the result in such a way, that it is accurate to 8 inches (1 foot is equal to 12 inches), since the King will not tolerate larger error in the estimates. Sample Input 9 100 200 400 300 400 300 300 400 300 400 400 500 400 500 200 350 200 200 200 Sample Output 1628
- weixin_30952103的博客 polygonal number is a number represented as dots or pebbles arranged in the shape of a regular polygon. The dots are thought of as alphas (units). These are one type of 2-dimensional figurate ...
- 5年前宣之于口的博客 In mathematics, a polygonal number is a number represented as dots or pebbles arranged in the shape of a regular polygon. The dots are thought of as alphas (units). These are one type of 2-dimensional...
- snowy_smile的博客 For each student, you are given the number of students who he/she shook hands with when he/she came in the area. For each student, you need to find the maximum number of friends he/she could possibly ...
- libulala的博客 Knights of a Polygonal Table Unlike Knights of a Round Table, Knights of a Polygonal Table deprived of nobility and happy to kill each other. But each knight has some power and a knight can kill ...
- 狂飙的小蜗牛呦的博客 Unlike Knights of a Round Table, Knights of a Polygonal Table deprived of nobility and happy to kill each other. But each knight has some power and a knight can kill another knight if and only if his ...
- 皮蛋咸鱼白菜粥的博客 Knights of a Polygonal Tabletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputUnlike Knights of a Round Table, Knights of a Polygonal Table depriv.....
- 人间多烦恼的博客 Knights of a Polygonal Tabletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputUnlike Knights of a Round Table, Knights of a Polygonal Table depriv.....
- wpfengqi的博客 Frame Polygonal Line Time Limit: 2 Seconds Memory Limit: 65536 KB You are going to read a sequence of pairs of integer numbers. Each pair represents the Cartesian coordinates of a point in
- shemplle的博客 Knights of a Polygonal Tabletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputUnlike Knights of a Round Table, Knights of a Polygonal Table depriv.....
- weixin_45439556的博客 Note|Polygonal Clustering Analysis Using Multilevel Graph-Partition背景提出算法FrameworkClustering StepsSimilarity Criteria实验与分析Evaluation of Clustering QualityThinking **1.**六种空间聚类方法 ...
- 4年前回答 2 已采纳 Description Hunter Bob often walks with his dog Ralph. Bob walks with a constant speed and his route is a polygonal line (possibly self-intersecting) whose vertices are specified by N pairs of integers (Xi, Yi) ? their Cartesian coordinates. Ralph walks on his own way but always meets his master at the specified N points. The dog starts his journey simultaneously with Bob at the point (X1, Y1) and finishes it also simultaneously with Bob at the point (XN, YN). Ralph can travel at a speed that is up to two times greater than his master's speed. While Bob travels in a straight line from one point to another the cheerful dog seeks trees, bushes, hummocks and all other kinds of interesting places of the local landscape which are specified by M pairs of integers (Xj',Yj'). However, after leaving his master at the point (Xi, Yi) (where 1 <= i < N) the dog visits at most one interesting place before meeting his master again at the point (Xi+1, Yi+1). Your task is to find the dog's route, which meets the above requirements and allows him to visit the maximal possible number of interesting places. The answer should be presented as a polygonal line that represents Ralph's route. The vertices of this route should be all points (Xi, Yi) and the maximal number of interesting places (Xj',Yj'). The latter should be visited (i.e. listed in the route description) at most once. An example of Bob's route (solid line), a set of interesting places (dots) and one of the best Ralph's routes (dotted line) are presented in the following picture: !(http://poj.org/images/1034/dog.gif) Input The first line of the input contains two integers N and M, separated by a space ( 2 <= N <= 100 ,0 <= M <=100 ). The second line contains N pairs of integers X1, Y1, ..., XN, YN, separated by spaces, that represent Bob's route. The third line contains M pairs of integers X1',Y1',...,XM',YM', separated by spaces, that represent interesting places. All points in the input file are different and their coordinates are integers not greater than 1000 by the absolute value. Output The first line of the output should contain the single integer K ? the number of vertices of the best dog's route. The second line should contain K pairs of coordinates X1'',Y1'' , ...,Xk'',Yk'', separated by spaces, that represent this route. If there are several such routes, then you may write any of them. Sample Input 4 5 1 4 5 7 5 2 -2 4 -4 -2 3 9 1 2 -1 3 8 -3 Sample Output 6 1 4 3 9 5 7 5 2 1 2 -2 4
- axiaobingqiu的博客 Knights of a Polygonal Table time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Unlike Knights of a Round Table, Knights of a Poly.....