The land price on the MMM island is extremely high. So people on the island all live in a very tall tower with one million floors!! There are N electric service companies (labeled 1 to N) and M power stations on the island. One power station belongs to exactly one company.
At the beginning, the company of each power station is given, and a company can choose one floor to build a power center. Assuming that there are k power stations (on floor a1,a2,...,ak) that belong to a company, and the company chooses floor x to build the power center, the daily cost of this company would be |a1-x|+|a2-x|+...+|ak-x|. MMM, the master of the island, has made a special rule:
x1 <=> x2 <=> x3 <=> ... <=> xn
The operator <=> can be either <= or >=. It means that the power centers chosen by the adjacent companies should follow the specified order. For example, if the rule is x1 <= x2 >= x3, it means that the power center of company 1 should not be higher than that of company 2, and the power center of company 2 should not be lower than that of company 3. Though there is no constraint between company 1 and company 3. If company 1 chooses floor 2 for the power center and company 2 chooses floor 3, the station of company 3 can only be in floor 1, 2 or 3.
Your task is to help the companies calculate their minimum total daily cost.
There are multiple test cases. The first line has an integer T (T ≤ 10), which indicates the number of test cases.
Each test case begins with two integers N and M (1 ≤ N ≤ M ≤ 5*10^5).
There are N - 1 operators on the second line, either '<=' or '>=', separated by spaces, indicating the rules between adjacent companies.
The third line has M pairs of integers. Each pair x_i, y_i describes the i-th power station, where x_i indicates the label of the floor and y_i indicates the label of the company, (1 ≤ x_i ≤ 10^6, 1 ≤ y_i ≤ N). It is guaranteed that each company has at least one power station.
For each test case, output the minimum total daily cost of the island.
2 1 3 1 4 2 4 2 5 3
7 3 9 3 3 2 4 2 5 2 6 1 7 1 8 1
<= >= <=
3 1 1 2 4 3 2 4
Description Dr. Octopus kidnapped Spiderman's girlfriend M.J. and kept her in the West Tower. Now the hero, Spiderman, has to reach the tower as soon as he can to rescue her, using his own weapon, the web. From Spiderman's apartment, where he starts, to the tower there is a straight road. Alongside of the road stand many tall buildings, which are definitely taller or equal to his apartment. Spiderman can shoot his web to the top of any building between the tower and himself (including the tower), and then swing to the other side of the building. At the moment he finishes the swing, he can shoot his web to another building and make another swing until he gets to the west tower. Figure-1 shows how Spiderman gets to the tower from the top of his apartment – he swings from A to B, from B to C, and from C to the tower. All the buildings (including the tower) are treated as straight lines, and during his swings he can't hit the ground, which means the length of the web is shorter or equal to the height of the building. Notice that during Spiderman's swings, he can never go backwards. !(http://poj.org/images/1925_1.jpg) You may assume that each swing takes a unit of time. As in Figure-1, Spiderman used 3 swings to reach the tower, and you can easily find out that there is no better way. Input The first line of the input contains the number of test cases K (1 <= K <= 20). Each case starts with a line containing a single integer N (2 <= N <= 5000), the number of buildings (including the apartment and the tower). N lines follow and each line contains two integers Xi, Yi, (0 <= Xi, Yi <= 1000000) the position and height of the building. The first building is always the apartment and the last one is always the tower. The input is sorted by Xi value in ascending order and no two buildings have the same X value. Output For each test case, output one line containing the minimum number of swings (if it's possible to reach the tower) or -1 if Spiderman can't reach the tower. Sample Input 2 6 0 3 3 5 4 3 5 5 7 4 10 4 3 0 3 3 4 10 4 Sample Output 3 -1
Simditor 是一个开源的富编辑器，项目地址是：http://simditor.tower.im/ 现在我有一问题，想要请教大家一下：我要实现附件上传的功能（不是图片上传），我要实现的效果是跟tower的附件上传的效果一样，从这个项目的文档来看，我确实找不到附件上传的功能？难道我要自己按照它的规范开发一个上传的button？ 但是tower居然都有已经有过这个上传附件的功能，这个项目开源，不会自己留有一手，故意没有开放这个功能吧？ 如果我要自己实现的话，有什么比较简单的方法吗？或者各位是否有别人已经有所实现，可以参考一下？ 谢谢
Stupid Tower Defense _course2017-09-22
Problem Description FSF is addicted to a stupid tower defense game. The goal of tower defense games is to try to stop enemies from crossing a map by building traps to slow them down and towers which shoot at them as they pass. The map is a line, which has n unit length. We can build only one tower on each unit length. The enemy takes t seconds on each unit length. And there are 3 kinds of tower in this game: The red tower, the green tower and the blue tower. The red tower damage on the enemy x points per second when he passes through the tower. The green tower damage on the enemy y points per second after he passes through the tower. The blue tower let the enemy go slower than before (that is, the enemy takes more z second to pass an unit length, also, after he passes through the tower.) Of course, if you are already pass through m green towers, you should have got m*y damage per second. The same, if you are already pass through k blue towers, the enemy should have took t + k*z seconds every unit length. FSF now wants to know the maximum damage the enemy can get. Input There are multiply test cases. The first line contains an integer T (T<=100), indicates the number of cases. Each test only contain 5 integers n, x, y, z, t (2<=n<=1500,0<=x, y, z<=60000,1<=t<=3) Output For each case, you should output "Case #C: " first, where C indicates the case number and counts from 1. Then output the answer. For each test only one line which have one integer, the answer to this question. Sample Input 1 2 4 3 2 1 Sample Output Case #1: 12
Tower Defense _course2017-03-23
Tower Defense(TD) is a kind of rpg game in the warcraft3, which is very popular. in this game, you can build some tower near the road, and the enemy come along the road. when the enemy in the tower's attack range, the tower can attack the enemy. and each attack the enemy's life will reduce as the damage of the tower. When the enemy's life less than or equals 0, it dies. The mission of TD is kill all the enemies. Now let's consider an easy situation. In the X-Y reference frame, there are n towers, each has a coordinate (x,y), an attack range, an attack type. m enemies come from (0,0) to (-10,0), in a line, with the length 2, and the enemies are come one by one. For example, in time 0 the all m enemies in (0,0), then in time 1 the first enemy go to (-2,0), in time 2 the first enemy go to (-4,0), the second enemy go to (-2,0), and so on, when an enemy go to (d,0)(d<=-10), we failed, even if it is still poisoned at this time, or we succeed. when the eneny in (0,0) and (d,0)(d<=-10), the tower can not attack, even if the enemy is in the tower's attack range. To simplify the problem, at each time each tower can attack once. when more than one enemy in its range, we can control it to attack any one, or even control it not attack, with the best strategy. There are three attack type: common attack: when an enemy is attacked, the life is reduced by the damage of the tower. poison attack: when an enemy is attacked, the life is first reduced by the damage of the tower. And in the next 2 times, the enemy's life will be reduced by the poison damage. if the enemy poisoned more than once, the damage will not double. For example, the enemy's life is 200, tower's damage is 100, poison damage is 20, in time 1, the enemy be attacked, then in time 1, the enemy's life is 100(200-100), in time 2 the enemy's life is 80(100-20), in time 3 the enemy's life is 60(100-20). freezing attack: when an enemy is attacked, the life is first reduced by the damage of the tower. And in next 2 times, the enemy's speed is reduced by half. For example, an enemy be attacked in (-2,0), then it first go to (-3,0), (-4,0), then go to (-6,0), the freezing can not double, too. The problem is give us n towers and m enemies, can we successful in the tower defense? Input: The first line of the input is n, m,life and poison_damage, the number of the towers, the number of the enemies, the life of enemy and the poison damage of poison attack. n<6, m<6, life<1000, 0<poison_damage<1000. Next n lines is the description of each tower, the first 5 number is x, y, range, damage, attack_type, the attack_type can be 0, 1, 2, which denote common attack, poison attack, freezing attack. 0<damage<1000. All are integers. a line with n=m=life=0 denoted the end of input. Output: If we succeed in the tower defense, output "succeed", or output "fail", in a separate line. Sample Input: 1 1 10 5 1 1 20 10 0 1 1 20 5 -2 0 1 10 0 2 2 40 5 -3 0 1 30 0 -7 0 1 10 0 0 0 0 5 Sample Output: succeed fail succeed
Block by Block _course2017-12-03
Problem Description Little Min Likes playing the "block by block" very much,she always plays it day and night.There are N types of blocks,each them have own Length and width of the bottom block and its height,we should place one block on the top another to build a tower and maximum the tower's height. Now we slight change in the next game.We place the blocks on the X-axis,every block has its begin coordinate si and end coordinate ei,which means the blocks' positions are stable on the X-axis,at the same time, its height is 1 unit.The i-th block can place on the top of j-th only when si >= sj && ei <= ej,then we will build one tower by the new rule. However,little Min thinks it is too easy for her,now she wants to better use of the number of blocks and the height of the tower she built can't be more than H.that is to say,to build the tower with H high or less,the more blocks she use,the happier she is! Note that two or more blocks can place on the same height except the bottom of the tower! The sample will tells the details. Input The first line contains an integer T, the number of test cases (T <= 20). Each test case is in the following format. The first line starts with an integer N (1 <= N <= 300) denoting the number of Blocks and an integer H (1 <= H <= 10) denoting the highest height of the tower. Then following N lines, Each line contains two integer si and ei (0 < si < ei <= 500). Output For each test case, print one line containing one integer S meaning the maximum number of blocks she can use to build one tower. Sample Input 2 4 3 1 10 1 4 4 9 6 8 5 3 1 10 1 4 4 9 3 5 12 14 Sample Output 4 3
Fire Tower _course2017-04-19
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
Description All the peoples living on Earth have decided that the hobbits, the keepers of the Ring of Power should be isolated in a region of the earth named Shire. The boundaries of the shire are represented by a convex polygon with a guard tower in each vertex. The positions of all the towers from the region (two unsigned integers referring to a rectangular axis system) are given. A guard on a white horse is watching the shire's boundaries going over all the distances between two successive towers, one after the other, walking on a minimum way, only on paths parallel with the axis of the axis system. The maximum length of the road that can be covered by the guard at a complete tour of the shire's boundaries is known and you are asked to determine a polygon with a maximum number of towers per outline, polygon that can be the boundary of the shire. Besides, the boundary has to contain the tower of Mordor (coordinates 0,0) on a vertex, in each of the other vertices being one of the existing towers. !(http://poj.org/images/1843_1.jpg) For example, for the towers location drawn in the figure above and for the 25 km limit of a tower made by a guard, the boundary of the shire can be made, in this order, from the towers of the following coordinates (0,0), (4,1), (8,3), (4,4), (1,4), (0,0). It can be observed that the polygon determined by these towers it's a convex polygon with 5 towers per outline. The polygon with (0,0), (4,1), (4,12), (0,7), (0,0) has itself 5 towers per outline, but a complete tour of this polygon is over 25 km. We should pay attention to the following observations: • There can be towers strictly inside the polygon, but these are not taken into consideration for the maximum criterion; • The degenerate polygon made only from one top (Mordor) or made from two towers (Mordor and another tower) or more collinear vertices it is considered a solution too; • There can be collinear towers on the determined polygon's outline; • In the input there are not two towers whose positions coincide and there is not a tower in the position (0,0). Input The input has the fllowing structure: N x1 y1 x2 y2 ... xN yN L N is the number of towers in the shire (excepting the implicit tower – Mordor), (x1, y1) ... (xN, yN) are coordinates (abscise, ordinate) of each of the N towers, and L is number representing the maximum length of a complete tour of the polygon. There are some restrictions: • 0 < N <= 50 • 0 <= xi, yi <= 200 • 0 < L < 1000 Output The output will contain the number of towers on the polygon's outline. Sample Input 9 0 7 1 4 2 2 4 1 4 4 4 9 8 3 9 9 10 5 25 Sample Output 5
Description Once upon a time, there were two graduate students that were best friends. During their short breaks from research (usually, not longer than several hours), the two students liked to play the game of Procrastination. The game of Procrastination is for two players (black and white), who take turns moving. The game involves removing cubes from towers. Each cube is either black or white. At the start of the game, these cubes are arranged into 4 towers: each tower is a stack of several cubes. On a player’s turn, he can remove any cube that matches his color (the white player removes only white cubes, and the black player only removes black cubes). All the cubes above the chosen cube are also removed from the tower, irrespective of color. For example, suppose a tower is composed of the following cubes (from bottom to top): black, white, black, white. Then, if black removes the bottom-most black cube, he removes the entire tower, black can also take the 3rd cube, removing the 4th cube with it. If white removes the 2nd cube, then only one black cube will remain, white can also take the 4th cube. If a player cannot remove any cubes, he loses. Having already been trained in the intricacies of the game during their undergraduate years, the two students learned to play the game perfectly, i.e., if a player had a winning strategy, then that player would win the game. However, at some time, they discovered that, for most starting configurations, one of the players has the winning strategy irrespective of which player moves first. They called a configuration a W-configuration if white has a winning strategy irrespective of who moves first, and a B-configuration if black has a winning strategy irrespective of who moves first. Moreover, the friends noted that some partial configurations are at least as favorable for one player as other configurations. A partial configuration C is defined as a set of 3 towers, note that a partial configuration C together with a 4th tower T forms a complete game configuration, which we denote as (C, T). A formal definition of the notion “at least as favorable”, is as follows. A partial configuration C1 (composed of 3 towers) is at least as favorable for white as another partial configuration C2 (also composed of 3 towers) if and only if for any 4th tower T, if (C2, T) is a W-configuration then (C1, T) is also a W-configuration. In other words, there does not exist a 4th tower T such that (C1, T) is not a W-configuration and (C2, T) is a W-configuration. Given two partial configurations C1 and C2, you are to check whether C1 is at least as favorable for white as the partial configuration C2. Input The first line of the input contains an integer, the number of test cases. A test case includes one line with Test N, where N is the current test case number followed by eight lines, specifying the two partial configurations C1 and C2 in this order. Each configuration is specified by four lines. The first line of the partial configuration contains three numbers: n1, n2, n3 denoting the heights of the three towers of the partial configuration (0 ≤ n1, n2, n3 ≤ 50). The second line contains n1 letters (B or W) separated by spaces describing the first tower. The third line contains n2 letters separated by spaces describing the second tower. The fourth line contains n3 letters separated by spaces describing the third tower. A letter W denotes a white cube and the letter B denotes a black cube. Each tower is described in the bottom-to-top order. Output For each test case, print on a separate line the test case number and Yes if C1 is at least as favorable for white as the partial configuration C2, and No otherwise. Sample Input 2 Test 1 3 3 1 W B B W B W B 3 3 3 B W W B W W W B B Test 2 3 3 2 W B B W B W B B 3 3 3 B W W B W W W B B Sample Output Test 1: Yes Test 2: No
Problem Description In their spare time of training, Alice and Charles often play Jenga together. As they've played the game together so many times, they both know each others' performance as well as themselves'. Now with their success rate of each move provided, can you tell in what probability each of them will win? And of course, Alice and Charles, like other ACM-ICPC contestants such as you, are very clever. Jenga is a game of physical and mental skill. In Jenga, players take turns to remove a block from a tower and balance it on top, creating a taller and increasingly unstable structure as the game progresses. Jenga is played with 54 wooden blocks. Each block is three times as long as it is wide. To set up the game, the included loading tray is used to stack the initial tower which has 18 levels of three blocks placed adjacent to each other along their long side and perpendicular to the previous level (so, for example, if the blocks in the first level lie lengthwise north-south, the second level blocks will lie east-west). Once the tower is built, the players take turns to move. Moving in Jenga consists of taking one and only one block from any level (except those mentioned later) of the tower, and placing it on the topmost level in order to complete it. The blocks in the top level, and the level below it if the top level is not completed, cannot be removed. However, if the top level is completed, the blocks in the one below it can be removed. The removed block should be placed to make the top level as same as the other level (with no block removed). The move is successful if the tower does not fall. The game ends when the tower falls, or no block can be removed without making the tower fall (rarely happened). And the loser is the player who made the tower fall (i.e., whose turn it was when the tower fell), or who cannot make the move. Now let's consider each level of the tower, there're only four types of valid arrangement of wooden blocks, as illustrated above. At the beginning of the game, they're all of the type A (or rotated by 90 degrees). And by removing a block from type A, one will get either type B or type C (or the mirrored equivalent of type C). No block from type B can be removed without making the tower fall. From type C we can only remove a block and result in type D. Then no block can be removed further. So there are only three types of moves: (1) A -> B, (2) A -> C and (3) C -> D, in addition to adding the removed block to the top level. As Alice and Charles have played Jenga so many times, their success rate of each move is very stable and can be formulated as P = b - d*n, where b is the player's base success rate of this type of move, d is the decrease of success rate for each additional level, and n is the number of levels in the tower before this move. The incomplete top level also counts as one level. For example, if the game begins with 18 levels, and both players have the same performance with b = 2.8 and d = 0.1, then P will be 1.0 for the first turn, and become 0.9 between the 2nd and the 4th turns. If P does not lie in the range [0, 1], the nearest number in the range is indicated. (E.g. when a player cannot fail the first several moves, P will be more than 1 until n is a bit larger.) Input The input file contains multiple test cases. The first line of the input file is a single integer T (T ≤ 500), the number of test cases. Each test cases begins with a line of n0 (3 ≤ n0 ≤ 18), the number of levels in the tower when the game starts. (When n0 is not 18, the rule sare the same.) The second line contains 6 real numbers ba1, da1, ba2, da2, ba3, da3, indicating Alice's base success rates and the decreases of success rates for each of the three moves: (1) A -> B, (2) A -> C and (3) C -> D. The third line also contains 6 real numbers bc1, dc1, bc2, dc2, bc3, dc3, those of Charles. (0 ≤ b - d*n0 ≤ 2 and 0 < d ≤ 0.5 for all the 6 pairs of parameters. No real number will have more than 4 digits after the decimal point.) Output For each test case, print a line with Alice's winning probability, assume that she always moves first. Your answer should be rounded to the 4th digit after the decimal point. Sample Input 2 3 1.3 0.1 1.3 0.1 1.3 0.1 1.3 0.1 1.3 0.1 1.3 0.1 4 1.5 0.1 1.5 0.1 1.5 0.1 1.5 0.1 1.5 0.1 1.5 0.1 Sample Output 0.1810 0.8190
Tower Parking _course2017-10-31
Problem Description There is a new revolution in the parking lot business: the parking tower. The concept is simple: you drive your car into the elevator at the entrance of the tower, and the elevator and conveyor belts drag the car to an empty parking spot, where the car remains until you pick it up. When you return, the elevator and conveyor belts move your car back to the entrance and you’re done. The layout of the tower is simple. There is one central elevator that transports the cars between the different floors. On each floor there is one giant circular conveyor belt on which the cars stand. This belt can move in clockwise and counterclockwise direction. When the elevator arrives on a floor, it becomes part of the belt so that cars can move through it. At the end of the day the tower is usually packed with cars and a lot of people come to pick them up. Customers are processed in a first come first serve order: the elevator is moved to the floor of the first car, the conveyor belt moves the car on the elevator, the elevator is moved down again, and so on. We like to know how long it takes before the last customer gets his car. Moving the elevator one floor up- or downwards takes 10 seconds and moving a conveyor belt one car in either direction takes 5 seconds. Input On the first line one positive number: the number of testcases, at most 100. After that per testcase: One line with two integers h and l with 1 ≤ h ≤ 50 and 2 ≤ l ≤ 50: the height of the parking tower and the length of the conveyor belts. h lines with l integers: the initial placement of the cars. The jth number on the ith line describes the jth position on the ith floor. This number is -1 if the position is empty, and r if the position is occupied by the rth car to pick up. The positive numbers form a consecutive sequence from 1 to the number of cars. The entrance is on the first floor and the elevator (which is initially empty) is in the first position. There is at least one car in the parking tower. Output Per testcase: One line with the number of seconds before the last customer is served. Sample Input 2 1 5 -1 2 1 -1 3 3 6 -1 5 6 -1 -1 3 -1 -1 7 -1 2 9 -1 10 4 1 8 -1 Sample Output 25 320
Bessie必须建一座干草堆。一共有N大包的干草（1<=N<=100000）(从1到N编号)依靠传送带连续的传输进牛棚来。第i包干草有一个 宽度W_i(1<=w_i<=10000)，高度为1。 Bessie必须利用所有N包干草来建立起干草堆，按顺序严格摆放。说得更清楚一些：一旦她将一个草包放在第二级 ，她不能将接下来的草包放在地基上。要求每一级不能比下面的一级宽。求最大高度。
Once upon a time, there was a temple. And the honor of the monks in the temple is their tower.One day, the Buddhist abbot wants to find out who is the smartest monk in the temple, so he gives the monks a problem: Calculate the area of the tower's shadow at a specific time of the day. Perhaps the mission is easy to complete with a directly measuring the shadow, but the Buddhist abbot makes it nearly impossible, he said: "Leave the shadow alone! You can only measure the tower itself!" Though all the monks are very smart, they still have no idea of this problem. So now it is your turn to solve it. The tower is formed with N floors, each floor is a hexagon, and every two adjacent floors will be linked by six congruent isosceles trapezoid (For example, floor N links to floor N-1, floor 2 links to floor 1, floor 1 links to floor 0). The top of the tower, which can be regarded as floor 0, is a dot (that is, it can be treated as a hexagon with a zero side length). Then floor 1 is the floor under floor 0, floor 2 is under floor 1, floor 3 is under floor 2...floor N is under floor (N - 1). Now let Ri equals to the side length of hexagon number i, Hi equals to the height of floor i (of course it's the height from the bottom), and you know the shadow's length L of a exactly vertically placed stick (Its height exactly equals to 1. We assume that sun light is parallel light, and it is perpendicular to two parallel sides of each hexagon). Now give you Ri, Hi and L, can you solve the problem? Input There are several test cases. In each case, there will be two numbers in the first line, N(integer, 1 <= N <= 150) and L(fraction, L >= 0), which represent the number of floot and the shadow's length of the stick. The next N + 1 lines describe the side length Ri and height Hi(i starts from 0 to N), each line contains only two numbers, Ri and Hi(fractions, 0.00 <= Ri, Hi < 1000.00).We guarantee that Hi > Hj(0 <= i < j <= N), R0 = 0 and Hn = 0. Output For each test case, you may output a float number S, which represents the area of the tower's shadow. Round S to 4 digits after decimal point. Sample Input 1 1.00 0.00 3.00 1.00 0.00 3 0.00 0.00 3.00 10.00 2.00 5.00 1.00 11.00 0.00 Sample Output 4.2990 314.3672
You have gone on a hiking trip, but now you are getting tired and would like to return home. As a precaution, you always take your mobile phone with you, so you can call for help in case of an emergency. However, it only works as long as you stay in range of (one of) the phone towers in the area. Fortunately, you know precisely where you are and where you are going, and you brought a map of the area showing the locations of the mobile phone towers. You want to take the shortest route home, while staying in range of at least one of those towers. Input On the first line an integer t (1 <= t <= 100): the number of test cases. Then for each test case: One line with two integers d (1 <= d <= 1 000) and t (1 <= t <= 100): the maximum distance to the nearest tower and the number of towers on the map, respectively. One line containing the starting location. One line containing the goal location. t lines each containing the location of a tower. All locations consist of two space-separated integer coordinates x and y (1 <= x, y <= 1 000). All locations in the input for a single test case will be distinct. The starting locating will not be more than d units away from the nearest tower. Output For each test case: One line containing the distance to the goal location, or -1 if the goal location is unreachable. Your answer should have either an absolute or a relative error of at most 10-6. Notes: It's OK to be exactly d units away from the nearest tower. The size of the towers is negligible; if you move straight through a tower location, the tower won��t block your path. Sample Input 1 2 3 1 1 8 2 2 2 4 4 7 3 Sample Output 7.23224071072994
MYSQL 数据库 有一个消息日志 MESSAGELOG 表，系统每隔2秒会向里面插入大概10条记录 现在这个表里面有30万条记录 有 id，time，label_id,tower_id,station_id 5个字段，id是主键 这个表的特点是 label_id,tower_id,station_id的重复非常多， 很多记录不同的地方就是时间time 不一样(当然还有id不一样) 比如label_id=226的记录有27216条，这个 27216 条记录的 label_id,tower_id,station_id都一样，就time不一样 这个查询： select count(1) from MESSAGELOG log LEFT join LABEL label on log.label_id = label.binary_id LEFT join DEVICE tower on log.tower_id = tower.binary_id LEFT join DEVICE station on log.station_id = station.binary_id where tower.type in ('TYPE_ONEWAYTOWER','TYPE_ALLWAYTOWER') and station.type = 'TYPE_STATION' 需要4秒。 MESSAGELOG 表 time,label_id,tower_id,station_id有索引，还有一个(label_id,tower_id,station_id)联合索引 MESSAGELOG 30万记录，LABEL 表20条记录，DEVICE 24条记录 上面的查询要用4秒，属于正常，还是慢？ 索引设计的合理么，该怎么设计？ 另外，这个日志表的数据会越来越多，对于300万，500万，乃至1000万的数据量，继续用MYSQL合适么？ 希望有经验的朋友说说。
本文主要研究的课题是：炉温系统的PID控制器设计研究 ，并且在MATLAB的大环境下进行模拟仿真。 (1)第一章 介绍课题的研究背景、意义以及发展现状。 (2)第二章 建立炉温系统数学模型 (3)第三
【超实用课程内容】 程序员对于算法一直又爱又恨！特别是在求职面试时，算法类问题绝对是不可逃避的提问点！本门课程作为算法面试系列的第一季，会从“知己知彼”的角度，聊聊关于算法面试的那些事～ 【哪些人适合学习这门课程？】 求职中的开发者，对于面试算法阶段缺少经验 想了解实际工作中算法相关知识 在职程序员，算法基础薄弱，急需充电 【超人气讲师】 孙秀洋 | 服务器端工程师 硕士毕业于哈工大计算机科学与技术专业，ACM亚洲区赛铜奖获得者，先后在腾讯和百度从事一线技术研发，对算法和后端技术有深刻见解。 【课程如何观看？】 PC端：https://edu.csdn.net/course/detail/27272 移动端：CSDN 学院APP（注意不是CSDN APP哦） 本课程为录播课，课程无限观看时长，但是大家可以抓紧时间学习后一起讨论哦~
java jdk 8 帮助文档 中文 文档 chm 谷歌翻译2017-04-02
JDK1.8 API 中文谷歌翻译版 java帮助文档 JDK API java 帮助文档 谷歌翻译 JDK1.8 API 中文 谷歌翻译版 java帮助文档 Java最新帮助文档 本帮助文档是使用谷
MATLAB基础入门课程，系统介绍MATLAB的基础知识。 主要从数组、运算、结构和绘图等几方面进行讲解 简单易懂，轻松入门MATLAB
十个c语言案例 （1）贪吃蛇 （2）五子棋游戏 （3）电话薄管理系统 （4）计算器 （5）万年历 （6）电子表 （7）客户端和服务器通信 （8）潜艇大战游戏 （9）鼠标器程序 （10）手机通讯录系统
- 下载 jquery实现的带缩略图的焦点图片切换(自动播放/响应鼠标动作)
- 下载 关于ASP.NET页面打印技术的常用方法总结
- 博客 （五）Tomcat架构及运行原理之IO多路复用
- 学院 手把手教你手写Spring框架(附源码)
- 博客 列出几种单表索引失效的情况?
- 下载 erl，rabbit 安装包
- 下载 js 在定义的时候立即执行的函数表达式(function)写法
- 下载 ASP.NET网页打印(只打印相关内容/自写功能)
- 博客 为什么中小型公司使用云服务器，而大型互联网（其他行业公司）全都使用物理机？
- 下载 js修改input的type属性及浏览器兼容问题探讨与解决
- 下载 js 实现在离开页面时提醒未保存的信息(减少用户重复操作)
- 下载 ExtJS中文乱码之GBK格式编码解决方案及代码
- 下载 python文字识别
- 学院 Vue.js快速入门
- 博客 2020-10-27
- 博客 LeetCode每日一题-二叉树的前序遍历
- 下载 8-jdk-alpine.tar
- 博客 基于java的银行账目管理系统
- 博客 MySql+Java中JDBC增删改查
- 博客 springboot任务
- 博客 手机端点开图片全屏且手指缩放
- 学院 Flutter编程指南之跨平台APP开发：手把手带您完成【我的备忘录】
- 学院 Android Jetpack架构组件及MVVM架构
- 下载 nodejs的require模块(文件模块/核心模块)及路径介绍
- 学院 基于SSM框架电影订票网站开发全程实录(附源码)
- 下载 .net页面访问次数统计实现原理与代码
- 学院 Unity基础入门
- 学院 Flutter编程指南之Dart语言：移动开发语言
- 学院 vue-element-admin从入门到进阶实战