 Treasure Map

You have come into possession of a pirate map that gives a series of steps to get from your landing place on a desert isle to the spot marked X where the treasure is located. Each step consists of a compass heading and a number of paces.
After spending most of your savings chartering a boat, you arrive at the island and, with the help of your portable GPS receiver, duly execute the instructions on the map. Alas, no treasure! On your return home you are astonished to learn that the pirates had no knowledge of GPS and used a magnetic compass to create the map. The pirates were unaware that their compass pointed to magnetic north rather than true north. The relative angle between magnetic north and true north varies depending where you are on the planet, but you are able to determine that on this particular desert isle, magnetic north is d degrees from true north. How close were you to the spot marked X at any moment while following the map?
Input
There are several test cases. Each test case begins with n <= 1000, the number of steps in the map. n lines follow; each consists of one of the 32 named compass points shown at right followed by a number of paces. The last line is a number giving the angle between magnetic north and true north, in degrees. A positive number indicates that magnetic north is to the east of true north; a negative indicates that it is to the west. The magnitude of this angle will not exceed 90 degrees. A line containing 0 follows the input for the last case.
Output
For each test case, output a single number, rounded to two decimal places, giving the least distance (in paces) that separated you from the treasure at any point while you were following the map.
Note: We use combinations of the letters N,E,S,W,b to abbreviate the names of the compass points. For example, NEbE stands for northeast by east. The 32 points are equally spaced about the compass. Clockwise, they are: N NbE NNE NEbN NE NEbE ENE EbN E EbS ESE SEbE SE SEbS SSE SbE S SbW SSW SWbS SW SWbW WSW WbS W WbN WNW NWbW NW NWbN NNW NbW.
Sample Input
2
NbE 10
EbS 10
90.00
2
NbE 10
EbS 10
90.00
0Sample Output
14.14
10.00
Treasure Map _course
20170207Your boss once had got many copies of a treasure map. Unfortunately, all the copies are now broken to many rectangular pieces, and what make it worse, he has lost some of the pieces. Luckily, it is possible to figure out the position of each piece in the original map. Now the boss asks you, the talent programmer, to make a complete treasure map with these pieces. You need to make only one complete map and it is not necessary to use all the pieces. But remember, pieces are not allowed to overlap with each other (See sample 2). Input The first line of the input contains an integer T (T <= 500), indicating the number of cases. For each case, the first line contains three integers n m p (1 <= n, m <= 30, 1 <= p <= 500), the width and the height of the map, and the number of pieces. Then p lines follow, each consists of four integers x1 y1 x2 y2 (0 <= x1 < x2 <= n, 0 <= y1 < y2 <= m), where (x1, y1) is the coordinate of the lowerleft corner of the rectangular piece, and (x2, y2) is the coordinate of the upperright corner in the original map. Cases are separated by one blank line. Output If you can make a complete map with these pieces, output the least number of pieces you need to achieve this. If it is impossible to make one complete map, just output 1. Sample Input 3 5 5 1 0 0 5 5 5 5 2 0 0 3 5 2 0 5 5 30 30 5 0 0 30 10 0 10 30 20 0 20 30 30 0 0 15 30 15 0 30 30 Sample Output 1 1 2
Treasure Map 地图_course
20200212Problem Description "Take 147 steps due north, turn 63 degrees clockwise, take 82 steps, ...". Most people don't realize how important accuracy is when following the directions on a pirate's treasure map. If you're even a tiny bit off at the start, you'll end up far away from the correct location at the end. Pirates therefore use very exact definitions. One step, for instance, has been defined by the 1670 Pirate Convention to be exactly two times the size of the wooden leg of Long John Silver, or 1.183 m in metricunits. Captain Borbassa was thus not at all worried when he set sail to the treasure island, having a rope with knots in it, exactly one step apart, for accurately measuring distances. Of course he also brought his good old geotriangle, once given to him by his father when he was six years old. However, on closer inspection of the map, he got an unpleasant surprise. The map was made by the famous captain Jack Magpie, who was notorious for including little gems into his directions.In this case, there were distances listed such as sqrt(33) steps. How do you measure that accurately? Fortunately, his first mate Pythagor came to the rescue. After puzzling for a few hours, he came up with the following solution: let pirate A go 4 steps into the perpendicular direction, and hold one end of the measuring rope there. Then pirate B goes into the desired direction while letting the rope slide through his fingers, until he is exactly 7 steps away from pirate A. Pythagor worked out a formula that states that pirate B has then traveled exactly sqrt(33) steps. Captain Borbassa was impressed, but he revealed that there were more such distances on the map. Paranoid as he is, he refuses to let Pythagor see the map, or even tell him what other distances there are on it. They are all square roots of integers, that's all he gets to know. Only on the island itself will the captain reveal the numbers, and then he expects Pyhtagor to quickly work out the smallest two integer numbers of steps that can combine to create the desired distance, using the method described above. Pythagor knows this is not easy, so he has asked your help. Can you help him by writing a program that can determine these two integers quickly? By the way, he did ask the captain how large the numbers inside the square root could get, and the captain replied "one billion". He was probably exaggerating, but you'd better make sure the program works. If you can successfully help the pirates, you'll get a share of the treasure. It might be gold, it might be silver, or it might even be... a treasure map! Input The first line of the input contains a single number: the number of test cases to follow. Each test case has the following format: 1.One line with one integer N, satisfying 1 <= N <= 10^9. Output For every test case in the input, the output should contain two nonnegative integers, separated by a space, on a single line: the distance pirate A needs to head in the perpendicular direction, and the final distance between pirate A and B, such that pirate B has traveled sqrt(N) steps. If there are multiple solutions, give the one with the smallest numbers. If there are no solutions, the output should be "IMPOSSIBLE" (without the quotation marks) on a single line. Sample Input 4 33 16 50 101 Sample Output 4 7 0 4 IMPOSSIBLE 50 51
Treasure Map 是如何实现的_course
20200116Problem Description "Take 147 steps due north, turn 63 degrees clockwise, take 82 steps, ...". Most people don't realize how important accuracy is when following the directions on a pirate's treasure map. If you're even a tiny bit off at the start, you'll end up far away from the correct location at the end. Pirates therefore use very exact definitions. One step, for instance, has been defined by the 1670 Pirate Convention to be exactly two times the size of the wooden leg of Long John Silver, or 1.183 m in metricunits. Captain Borbassa was thus not at all worried when he set sail to the treasure island, having a rope with knots in it, exactly one step apart, for accurately measuring distances. Of course he also brought his good old geotriangle, once given to him by his father when he was six years old. However, on closer inspection of the map, he got an unpleasant surprise. The map was made by the famous captain Jack Magpie, who was notorious for including little gems into his directions.In this case, there were distances listed such as sqrt(33) steps. How do you measure that accurately? Fortunately, his first mate Pythagor came to the rescue. After puzzling for a few hours, he came up with the following solution: let pirate A go 4 steps into the perpendicular direction, and hold one end of the measuring rope there. Then pirate B goes into the desired direction while letting the rope slide through his fingers, until he is exactly 7 steps away from pirate A. Pythagor worked out a formula that states that pirate B has then traveled exactly sqrt(33) steps. Captain Borbassa was impressed, but he revealed that there were more such distances on the map. Paranoid as he is, he refuses to let Pythagor see the map, or even tell him what other distances there are on it. They are all square roots of integers, that's all he gets to know. Only on the island itself will the captain reveal the numbers, and then he expects Pyhtagor to quickly work out the smallest two integer numbers of steps that can combine to create the desired distance, using the method described above. Pythagor knows this is not easy, so he has asked your help. Can you help him by writing a program that can determine these two integers quickly? By the way, he did ask the captain how large the numbers inside the square root could get, and the captain replied "one billion". He was probably exaggerating, but you'd better make sure the program works. If you can successfully help the pirates, you'll get a share of the treasure. It might be gold, it might be silver, or it might even be... a treasure map! Input The first line of the input contains a single number: the number of test cases to follow. Each test case has the following format: 1.One line with one integer N, satisfying 1 <= N <= 10^9. Output For every test case in the input, the output should contain two nonnegative integers, separated by a space, on a single line: the distance pirate A needs to head in the perpendicular direction, and the final distance between pirate A and B, such that pirate B has traveled sqrt(N) steps. If there are multiple solutions, give the one with the smallest numbers. If there are no solutions, the output should be "IMPOSSIBLE" (without the quotation marks) on a single line. Sample Input 4 33 16 50 101 Sample Output 4 7 0 4 IMPOSSIBLE 50 51
Map _course
20170124Description A pirate's treasure map typically contains a series of instructions which, if followed, lead you from the landing place on a desert isle to the spot marked X where the treasure is buried. You are to construct such a series of instructions for a particular desert isle. The island is a circle with radius r paces whose centre is at (0,0). Relative to the centre, the point (0,1) is north, (0,1) is south, (1,0) is east, and (1,0) is west. Also, (1,1) is northeast, (1,1) is southeast, (1,1) is northwest, and (1,1) is southwest. The landing place, on the circumference, is specified by its coordinates. The spot marked X, on the surface of the island is also specified by its coordinates. Each instruction in the sequence should have the form direction distance where direction is one of { north, south, east, west, northeast, northwest, southeast, southwest } and distance is a nonnegative real number indicating the number of paces to be travelled in the given direction. When executed as a sequence the instructions should lead from the landing place to the spot marked X without leaving the island. The total distance (that is, the sum of the distances in your sequence) should be minimized. From the possible sequences that minimize total distance, choose one with the minimum number of instructions. Input Input will consist of a number of test cases, followed by a line containing 1. Each test case consists of a single line containing five real numbers: r, x, y, X, Y. r is the radius of the island; x,y are the coordinates of the landing place; X,Y are the coordinates of the spot marked X. The landing place and the spot marked X are distinct. Output For each test case, output the sequence, one instruction per line. Distances should be accurate to ten places after the decimal, as shown. Output an empty line between test cases. Sample Input 100.0 0.0 100.0 25.0 50.0 1 Sample Output south 25.0000000000 southeast 35.3553390593
There's Treasure Everywhere! _course
20170310Finding buried treasures is simple: all you need is a map! The pirates in the Caribbean were famous for their enormous buried treasures and their elaborate maps. The maps usually read like ``Start at the lone palm tree. Take three steps towards the forest, then seventeen step towards the small spring, . . . blahblah . . . , finally six steps toward the giant rock. Dig right here, and you will find my treasure!'' Most of these directions just boil down to taking the mentioned number of steps in one of the eight principal compass directions (depicted in the left of the figure). Obviously, following the paths given by these maps may lead to an interesting tour of the local scenery, but if one is in a hurry, there is usually a much faster way: just march directly from your starting point to the place where the treasure is buried. Instead of taking three steps north, one step east, one step north, three steps east, two steps south and one step west (see figure), following the direct route (dashed line in figure) will result in a path of about 3.6 steps. You are to write a program that computes the location of and distance to a buried treasure, given a `traditional' map. Input The input contains several strings, each one on a line by itself, and each one consisting of at most 200 characters. The last string will be END, signaling the end of the input. All other strings describe one treasure map each, according to the following format: The description is a commaseparated list of pairs of lengths (positive integers less than 1000) and directions (N (north), NE (northeast), E (east), SE (southeast), S (south), SW (southwest), W (west) or NW (northwest)). For example, 3W means 3 steps to the west, and 17NE means 17 steps to the northeast. A full stop (.) terminates the description, which contains no blanks. Output For every map description in the input, first print the number of the map, as shown in the sample output. Then print the absolute coordinates of the treasure, in the format ``The treasure is located at (x,y).''. The coordinate system is oriented such that the xaxis points east, and the yaxis points north. The path always starts at the origin (0,0). On the next line print the distance to that position from the point (0,0), in the format ``The distance to the treasure is d.''. The fractional values x, y, d must be printed exact to three digits to the right of the decimal point. Print a blank line after each test case. Sample Input 3N,1E,1N,3E,2S,1W. 10NW. END Sample Output Map #1 The treasure is located at (3.000,2.000). The distance to the treasure is 3.606. Map #2 The treasure is located at (7.071,7.071). The distance to the treasure is 10.000.
Unknown Treasure _course
20170926Problem Description On the way to the next secret treasure hiding place, the mathematician discovered a cave unknown to the map. The mathematician entered the cave because it is there. Somewhere deep in the cave, she found a treasure chest with a combination lock and some numbers on it. After quite a research, the mathematician found out that the correct combination to the lock would be obtained by calculating how many ways are there to pick m different apples among n of them and modulo it with M. M is the product of several different primes. Input On the first line there is an integer T(T≤20) representing the number of test cases. Each test case starts with three integers n,m,k(1≤m≤n≤1018,1≤k≤10) on a line where k is the number of primes. Following on the next line are k different primes p1,...,pk. It is guaranteed that M=p1⋅p2⋅⋅⋅pk≤1018 and pi≤105 for every i∈{1,...,k}. Output For each test case output the correct combination on a line. Sample Input 1 9 5 2 3 5 Sample Output 6
The Treasure _course
20170127Description We have arrived at the age of the Internet. Many software applications have transformed from standalone to online applications. Computer games are following this trend as well. Online games are becoming more and more popular, not only because they are more intelligent, but also because they can bring great profits. "The computer game industry is developing rapidly in China. Online game revenues amounted to 1.3 billion Yuan last year and are expected to reach 6.7 billion Yuan by 2007." reported by China Daily in 2004. However, good games originate from good programmers. We take for example that there is a RPG (Role Playing Game) and your boss asks you to implement some tasks. For simplicity’s sake, we assume there are two kinds of roles in this game: one is player and the other is monster. You should help the player to achieve the goal: reach the place where treasure is positioned as early as possible and get the treasure. The map of the game is a matrix of N * M identical cells. Some cells are passable blocks, and others are nonpassable rocks. At any time, there is at most one role occupying a block. At the beginning, the time is set to 0, and the player is at a certain block. He then moves towards the treasure. At each turn, we have some rules: The player can stay in the same block during the next onesecond time duration, or he can walk or run towards the east, south, west, north, northeast, northwest, southeast, and southwest. With walking, the player can arrive at the corresponding passable blocks around him (See Fig.1). Each move takes 1 second. With running, the player can arrive at the corresponding passable blocks 2 cells away from him (See Fig.2). Each run takes 1 second. As demonstrated in Fig.3, if a neighbor cell is not passable, the player cannot run in that direction. For example, if cell 2 is a rock, running from 1 to 3 is impossible. The monsters are classified into aggressive and nonaggressive. If a monster occupies a cell, the player cannot move into that cell or run through that cell. In addition, the player cannot move into the cells surrounding an aggressive monster, because it will attack the player near it. For example, in Fig.4, if there is an aggressive monster in 5, then the cell 1, 2, 3, 4, 6, 7, 8 and 9 are in its attacking region, so the player cannot stay in or pass through these cells. Monsters change their positions each turn. Each monster appears by its position sequence iteratively. That's to say, given the position sequence of monster i: (x1, y1), (x2, y2), ..., (xs, ys), its initial position is (x1, y1) at time 0, then it appears in (x2, y2) at time 1, and so on. When monster i arrives at (xs, ys) at time s1, it will arrive in (x1, y1) at time s, and start to repeat. At the start of each turn, all the monsters change their positions first (the way of changing is given above). If a monster appears in the player's cell, or if an aggressive monster appears near the player to put him in its attacking region, the player will die, and the goal cannot be achieved. After all the monsters change their positions, the player makes a move or stays in the same cell. In his move, the moving path should not be occupied by any rocks or monsters or in the attacking region of any aggressive monsters. When counting the total time, we can neglect the time between monsters' position change and the player's move. Given the map of the game, the player's starting position, the treasure position and all the monsters' positions in every second, your task is to write a program to find the minimum time that the player gets the treasure. Input The input consists of several test cases. The first line of each case contains two integers N and M (1 <= N, M <= 100), where N is the height of the map and M is the width of the map. This is followed by N lines each containing M characters representing the map. A '#' represents a rock, a '.' is a free block, 'p' is the starting position of the player, 't' is the position of the treasure, 'n' is the initial position of a nonaggressive monster, and an 'a' stands for the initial position of an aggressive monster. The cell (i, j) is the jth cell on the ith row counting from left to right. The rows are counted from 1 to N starting from the first line of the matrix. We can number all the monsters as 1, 2, 3… according to their initial position, sorting first by row, then by column. The (n+2)th line contains an integer p (0 <= p <= 100), which is the total number of monsters (i.e. the total number of 'n's and 'a's in the matrix). It is followed by p lines each specifying a monster's position sequence in the following format: the ith (1 <= i <= p) line corresponds to monster i, which begins with an integer s (1 <= s <= 100), meaning the length of position sequence. Then s pairs of integers x1, y1, x2, y2, …, xs, ys are followed, separated by blanks. Each pair is a free block in the map, (i.e. a monster never goes to a rock cell). It is assured that none of the aggressive monsters' initial position is around the player. Two consecutive cases are separated by a blank line. The input is terminated by a line containing a pair of zeros. Output For each test case, output the minimum total time required for the player to get the treasure, in seconds. If it's not possible to get the treasure, or the minimum required time is greater than 100 seconds, please print a line just containing the string "impossible". Two consecutive cases should be separated by a blank line. Sample Input 7 8 #.#####. #.t#..p. #..#.... ..#a.#.# #...##.n .#...... ........ 2 2 4 4 5 4 3 5 8 6 8 5 7 3 3 p#. ##. t.. 0 2 2 #t p# 0 0 0 Sample Output 8 impossible 1
Searching Treasure in Deep Sea 怎么编写的_course
20190915Problem Description A deepsea salvage company found out that there was a sunken ship in some deepsea area of the Pacific with a case of priceless treasure in it. The senior leaders concluded as followed: There may be some sea monsters, they may cause some distraction. The company had some most advanced intelligent underwater robots. They were equipped with enough weapons to kill the monster. After they research a map, they got information as follow (according to the Sample Input): S indicated the starting place. E indicated the place of the treasure case. D indicated the doors of the rooms in the ship. K indicated the keys which were needed while opening the doors. H indicated the stairs went up. L indicated the stairs went down. "#" indicated the walls which separated the rooms. Every lowercase in the map indicated a monster. The enclosed space formed by the doors and the walls was called a separated room. Entering a room needed a key K to open a door D. After that, the key could not be used any more, the door would be open for ever, and there would be no need to use the key. The total number of rooms in the ship was not exceeding 30, the total number of the monsters in the ship was not exceeding 26, and the number of the monsters in each room would not exceed 3. There was no monster in the rooms where S and E, H and L were in. The advanced intelligent underwater robot carried a machine gun whose cartridge clip capacity was 100 bullets and enough spare ammunition. It could reload the bullets if given a chance. The surface of its body was equipped with 100 components. If all the components were destroyed while fighting with the monster, the robot could not function any more and would sink into the sea for ever. If only a part of the components was destroyed, the robot could recover if given a chance.The robot could attack the monsters in two ways; one is feign attack, and the other fierce attack. The feign attack would cause 1 reduction of the monsters' life value, and the fierce attack would cause a certain amount of deduction of the monsters' life value according to the degree of the fierce attack. The robot had 10 kinds of fierce attack tactics at most. Every attack tactics differed in bullet consumption and the certain reduction of the monsters' life value. For example, a certain kind of attack tactics would consume 30 bullets, and reduce 35 life value of the monster. The life of the monster was so limited that when the injuries accumulated to a certain amount it would be killed. Suppose its life value was 100, and every attack would reduce a certain amount of life value. When robot enters the treasure vessel, it searches the rooms one by one. As soon as it encounters the monsters, it will attack the monsters immediately. By consuming a certain amount of ammunition, a certain amount of the life value of the monsters is reduced. And then, the monsters attack the robot and destroy a certain number of robot's parts. Then they attack each other alternately like this. However, each time the robot launches attack firstly. If there are two or more monsters, the robot must kill the first one before another attack, and the monsters won't help each other in the battle. The choice of the order of attack is decisive when a number of monsters are in a room, because it closely relates with the final result of this battle. The robot itself and machine guns it takes possess the capacity of restoration. The robot will reload 2 bullets when it launches an attack. In the same room, the robot will repair 10 damaged parts of the body surface and refilled cartridges after it kills a monster. The robot can't leave the room until all monsters are eradicated. At the time he leaves the room, 100 damaged parts are repaired and 100 cartridges are refilled again. It should be noted that, under no circumstances will the robot's parts and bullets of cartridges be more than 100. Now intelligent underwater robot has been put into the sea, gradually approaching the location of the treasure vessel. Whether it can eradicate deepsea monsters, and return the treasure box is the problem that you are supposed to resolve. Input There are several test cases. The first line of each case has 3 positive integers k, n and m (1 <= k <= 3, 1 <n, m <= 100), indicating that the deepsea shipwreck is of k floors, each floor is a maze composed by n rows and m columns. (The Sample Input map is seen as below). That is, the maze is composed by characters of n lines, and each line has m characters. The following line has an integer p (0 <= p <= 10), indicating that there are p kinds of fierce attack tactics for the robot. Then there are a lines and each line has two positive integers, indicating the consumption of the number of bullets and reduction of the life value of the monsters as a result of injury by the robot's tactics. Then there is an integer q (0 <= q <= 26) taking up one line to indicate that there are q monsters in the treasure vessel. The following are q lines, and each line has one positive integer, indicating the number of damaged parts of the robot by those q monsters for one attack. Monsters are expressed in lowercase letters which are formed as a sequential increase from latter "a" to the letter "z". For example, when q = 10, then the names of the monsters are a, b, c, d, e, f, g, h, i, j, then the 10 lines of positive integers are the number of destroyed parts of robot as the result of the attack of those 10 monsters. Finally, there are k * n lines, every n lines indicates a floor of the ship, each line has m characters. The K floors are given from high to low. Input is terminated by the end of the file. Output For Each test case, if it can arrive "E" place, then output "Yes", or output "No". Each output takes up one line. Sample Input 1 5 10 0 0 ＃＃＃＃＃＃＃＃＃＃ ＃Ｓ ＃Ｋ ＃ Ｅ＃ ＃ ＃Ｋ ＃ ＃ ＃ Ｄ Ｄ ＃ ＃＃＃＃＃＃＃＃＃＃ 3 5 10 1 1 10 3 1 2 3 ＃＃＃＃＃＃＃＃＃＃ ＃ ＃ａＫＫＫＫ＃ ＃ＬＫＤｃＫＫＫＫ＃ ＃＃＃＃ｂＫＫＫＫ＃ ＃＃＃＃＃＃＃＃＃＃ ＃＃＃＃＃＃＃＃＃＃ ＃ ＤＬ Ｋ＃ ＃Ｈ ＃＃＃＃＃＃＃ ＃ Ｄ Ｄ Ｅ＃ ＃＃＃＃＃＃＃＃＃＃ ＃＃＃＃＃＃＃＃＃＃ ＃ ＃ ＃ Ｈ ＃ ＃ Ｓ ＃ ＃＃＃＃＃＃＃＃＃＃ Sample Output No Yes
Treasure of the Chimp Island _course
20170714Problem Description Bob Bennett, the young adventurer, has found the map to the treasure of the Chimp Island, where the ghost zombie pirate LeChimp, the infamous evil pirate of the Caribbeans has hidden somewhere inside the Zimbu Memorial Monument (ZM2). ZM2 is made up of a number of corridors forming a maze. To protect the treasure, LeChimp has placed a number of stone blocks inside the corridors to block the way to the treasure. The map shows the hardness of each stone block which determines how long it takes to destroy the block. ZM2 has a number of gates on the boundary from which Bob can enter the corridors. Fortunately, there may be a pack of dynamites at some gates, so that if Bob enters from such a gate, he may take the pack with him. Each pack has a number of dynamites that can be used to destroy the stone blocks in a much shorter time. Once entered, Bob cannot exit ZM2 and enter again, nor can he walk on the area of other gates (so, he cannot pick more than one pack of dynamites). The hardness of the stone blocks is an integer between 1 and 9, showing the number of days required to destroy the block. We neglect the time required to travel inside the corridors. Using a dynamite, Bob can destroy a block almost immediately, so we can ignore the time required for it too. The problem is to find the minimum time at which Bob can reach the treasure. He may choose any gate he wants to enter ZM2. Input The input consists of multiple test cases. Each test case contains the map of ZM2 viewed from the above. The map is a rectangular matrix of characters. Bob can move in four directions up, down, left, and right, but cannot move diagonally. He cannot enter a location shown by asterisk characters (*), even using all his dynamites! The character ($) shows the location of the treasure. A digit character (between 1 and 9) shows a stone block of hardness equal to the value of the digit. A hash sign (#) which can appear only on the boundary of the map indicates a gate without a dynamite pack. An uppercase letter on the boundary shows a gate with a pack of dynamites. The letter A shows there is one dynamite in the pack, B shows there are two dynamite in the pack and so on. All other characters on the boundary of the map are asterisks. Corridors are indicated by dots (.). There is a blank line after each test case. The width and the height of the map are at least 3 and at most 100 characters. The last line of the input contains two dash characters (). Output For each test case, write a single line containing a number showing the minimum number of days it takes Bob to reach the treasure, if possible. If the treasure is unreachable, write IMPOSSIBLE. Sample Input *****#********* *.1....4..$...* *..***..2.....* *..2..*****..2* *..3..******37A *****9..56....* *.....******..* ***CA********** ***** *$3** *.2** ***#*  Sample Output 1 IMPOSSIBLE
The Treasure 什么思路_course
20191004Description We have arrived at the age of the Internet. Many software applications have transformed from standalone to online applications. Computer games are following this trend as well. Online games are becoming more and more popular, not only because they are more intelligent, but also because they can bring great profits. "The computer game industry is developing rapidly in China. Online game revenues amounted to 1.3 billion Yuan last year and are expected to reach 6.7 billion Yuan by 2007." reported by China Daily in 2004. However, good games originate from good programmers. We take for example that there is a RPG (Role Playing Game) and your boss asks you to implement some tasks. For simplicity’s sake, we assume there are two kinds of roles in this game: one is player and the other is monster. You should help the player to achieve the goal: reach the place where treasure is positioned as early as possible and get the treasure. The map of the game is a matrix of N * M identical cells. Some cells are passable blocks, and others are nonpassable rocks. At any time, there is at most one role occupying a block. At the beginning, the time is set to 0, and the player is at a certain block. He then moves towards the treasure. At each turn, we have some rules: The player can stay in the same block during the next onesecond time duration, or he can walk or run towards the east, south, west, north, northeast, northwest, southeast, and southwest. With walking, the player can arrive at the corresponding passable blocks around him (See Fig.1). Each move takes 1 second. With running, the player can arrive at the corresponding passable blocks 2 cells away from him (See Fig.2). Each run takes 1 second. As demonstrated in Fig.3, if a neighbor cell is not passable, the player cannot run in that direction. For example, if cell 2 is a rock, running from 1 to 3 is impossible. The monsters are classified into aggressive and nonaggressive. If a monster occupies a cell, the player cannot move into that cell or run through that cell. In addition, the player cannot move into the cells surrounding an aggressive monster, because it will attack the player near it. For example, in Fig.4, if there is an aggressive monster in 5, then the cell 1, 2, 3, 4, 6, 7, 8 and 9 are in its attacking region, so the player cannot stay in or pass through these cells. Monsters change their positions each turn. Each monster appears by its position sequence iteratively. That's to say, given the position sequence of monster i: (x1, y1), (x2, y2), ..., (xs, ys), its initial position is (x1, y1) at time 0, then it appears in (x2, y2) at time 1, and so on. When monster i arrives at (xs, ys) at time s1, it will arrive in (x1, y1) at time s, and start to repeat. At the start of each turn, all the monsters change their positions first (the way of changing is given above). If a monster appears in the player's cell, or if an aggressive monster appears near the player to put him in its attacking region, the player will die, and the goal cannot be achieved. After all the monsters change their positions, the player makes a move or stays in the same cell. In his move, the moving path should not be occupied by any rocks or monsters or in the attacking region of any aggressive monsters. When counting the total time, we can neglect the time between monsters' position change and the player's move. Given the map of the game, the player's starting position, the treasure position and all the monsters' positions in every second, your task is to write a program to find the minimum time that the player gets the treasure. Input The input consists of several test cases. The first line of each case contains two integers N and M (1 <= N, M <= 100), where N is the height of the map and M is the width of the map. This is followed by N lines each containing M characters representing the map. A '#' represents a rock, a '.' is a free block, 'p' is the starting position of the player, 't' is the position of the treasure, 'n' is the initial position of a nonaggressive monster, and an 'a' stands for the initial position of an aggressive monster. The cell (i, j) is the jth cell on the ith row counting from left to right. The rows are counted from 1 to N starting from the first line of the matrix. We can number all the monsters as 1, 2, 3… according to their initial position, sorting first by row, then by column. The (n+2)th line contains an integer p (0 <= p <= 100), which is the total number of monsters (i.e. the total number of 'n's and 'a's in the matrix). It is followed by p lines each specifying a monster's position sequence in the following format: the ith (1 <= i <= p) line corresponds to monster i, which begins with an integer s (1 <= s <= 100), meaning the length of position sequence. Then s pairs of integers x1, y1, x2, y2, …, xs, ys are followed, separated by blanks. Each pair is a free block in the map, (i.e. a monster never goes to a rock cell). It is assured that none of the aggressive monsters' initial position is around the player. Two consecutive cases are separated by a blank line. The input is terminated by a line containing a pair of zeros. Output For each test case, output the minimum total time required for the player to get the treasure, in seconds. If it's not possible to get the treasure, or the minimum required time is greater than 100 seconds, please print a line just containing the string "impossible". Two consecutive cases should be separated by a blank line. Sample Input 7 8 #.#####. #.t#..p. #..#.... ..#a.#.# #...##.n .#...... ........ 2 2 4 4 5 4 3 5 8 6 8 5 7 3 3 p#. ##. t.. 0 2 2 #t p# 0 0 0 Sample Output 8 impossible 1
Treasure of the Chimp Island 算法实现_course
20200204Problem Description Bob Bennett, the young adventurer, has found the map to the treasure of the Chimp Island, where the ghost zombie pirate LeChimp, the infamous evil pirate of the Caribbeans has hidden somewhere inside the Zimbu Memorial Monument (ZM2). ZM2 is made up of a number of corridors forming a maze. To protect the treasure, LeChimp has placed a number of stone blocks inside the corridors to block the way to the treasure. The map shows the hardness of each stone block which determines how long it takes to destroy the block. ZM2 has a number of gates on the boundary from which Bob can enter the corridors. Fortunately, there may be a pack of dynamites at some gates, so that if Bob enters from such a gate, he may take the pack with him. Each pack has a number of dynamites that can be used to destroy the stone blocks in a much shorter time. Once entered, Bob cannot exit ZM2 and enter again, nor can he walk on the area of other gates (so, he cannot pick more than one pack of dynamites). The hardness of the stone blocks is an integer between 1 and 9, showing the number of days required to destroy the block. We neglect the time required to travel inside the corridors. Using a dynamite, Bob can destroy a block almost immediately, so we can ignore the time required for it too. The problem is to find the minimum time at which Bob can reach the treasure. He may choose any gate he wants to enter ZM2. Input The input consists of multiple test cases. Each test case contains the map of ZM2 viewed from the above. The map is a rectangular matrix of characters. Bob can move in four directions up, down, left, and right, but cannot move diagonally. He cannot enter a location shown by asterisk characters (*), even using all his dynamites! The character ($) shows the location of the treasure. A digit character (between 1 and 9) shows a stone block of hardness equal to the value of the digit. A hash sign (#) which can appear only on the boundary of the map indicates a gate without a dynamite pack. An uppercase letter on the boundary shows a gate with a pack of dynamites. The letter A shows there is one dynamite in the pack, B shows there are two dynamite in the pack and so on. All other characters on the boundary of the map are asterisks. Corridors are indicated by dots (.). There is a blank line after each test case. The width and the height of the map are at least 3 and at most 100 characters. The last line of the input contains two dash characters (). Output For each test case, write a single line containing a number showing the minimum number of days it takes Bob to reach the treasure, if possible. If the treasure is unreachable, write IMPOSSIBLE. Sample Input *****#********* *.1....4..$...* *..***..2.....* *..2..*****..2* *..3..******37A *****9..56....* *.....******..* ***CA********** ***** *$3** *.2** ***#*  Sample Output 1 IMPOSSIBLE
Searching Treasure in Deep Sea 深度搜索_course
20200216Problem Description A deepsea salvage company found out that there was a sunken ship in some deepsea area of the Pacific with a case of priceless treasure in it. The senior leaders concluded as followed: There may be some sea monsters, they may cause some distraction. The company had some most advanced intelligent underwater robots. They were equipped with enough weapons to kill the monster. After they research a map, they got information as follow (according to the Sample Input): S indicated the starting place. E indicated the place of the treasure case. D indicated the doors of the rooms in the ship. K indicated the keys which were needed while opening the doors. H indicated the stairs went up. L indicated the stairs went down. "#" indicated the walls which separated the rooms. Every lowercase in the map indicated a monster. The enclosed space formed by the doors and the walls was called a separated room. Entering a room needed a key K to open a door D. After that, the key could not be used any more, the door would be open for ever, and there would be no need to use the key. The total number of rooms in the ship was not exceeding 30, the total number of the monsters in the ship was not exceeding 26, and the number of the monsters in each room would not exceed 3. There was no monster in the rooms where S and E, H and L were in. The advanced intelligent underwater robot carried a machine gun whose cartridge clip capacity was 100 bullets and enough spare ammunition. It could reload the bullets if given a chance. The surface of its body was equipped with 100 components. If all the components were destroyed while fighting with the monster, the robot could not function any more and would sink into the sea for ever. If only a part of the components was destroyed, the robot could recover if given a chance.The robot could attack the monsters in two ways; one is feign attack, and the other fierce attack. The feign attack would cause 1 reduction of the monsters' life value, and the fierce attack would cause a certain amount of deduction of the monsters' life value according to the degree of the fierce attack. The robot had 10 kinds of fierce attack tactics at most. Every attack tactics differed in bullet consumption and the certain reduction of the monsters' life value. For example, a certain kind of attack tactics would consume 30 bullets, and reduce 35 life value of the monster. The life of the monster was so limited that when the injuries accumulated to a certain amount it would be killed. Suppose its life value was 100, and every attack would reduce a certain amount of life value. When robot enters the treasure vessel, it searches the rooms one by one. As soon as it encounters the monsters, it will attack the monsters immediately. By consuming a certain amount of ammunition, a certain amount of the life value of the monsters is reduced. And then, the monsters attack the robot and destroy a certain number of robot's parts. Then they attack each other alternately like this. However, each time the robot launches attack firstly. If there are two or more monsters, the robot must kill the first one before another attack, and the monsters won't help each other in the battle. The choice of the order of attack is decisive when a number of monsters are in a room, because it closely relates with the final result of this battle. The robot itself and machine guns it takes possess the capacity of restoration. The robot will reload 2 bullets when it launches an attack. In the same room, the robot will repair 10 damaged parts of the body surface and refilled cartridges after it kills a monster. The robot can't leave the room until all monsters are eradicated. At the time he leaves the room, 100 damaged parts are repaired and 100 cartridges are refilled again. It should be noted that, under no circumstances will the robot's parts and bullets of cartridges be more than 100. Now intelligent underwater robot has been put into the sea, gradually approaching the location of the treasure vessel. Whether it can eradicate deepsea monsters, and return the treasure box is the problem that you are supposed to resolve. Input There are several test cases. The first line of each case has 3 positive integers k, n and m (1 <= k <= 3, 1 <n, m <= 100), indicating that the deepsea shipwreck is of k floors, each floor is a maze composed by n rows and m columns. (The Sample Input map is seen as below). That is, the maze is composed by characters of n lines, and each line has m characters. The following line has an integer p (0 <= p <= 10), indicating that there are p kinds of fierce attack tactics for the robot. Then there are a lines and each line has two positive integers, indicating the consumption of the number of bullets and reduction of the life value of the monsters as a result of injury by the robot's tactics. Then there is an integer q (0 <= q <= 26) taking up one line to indicate that there are q monsters in the treasure vessel. The following are q lines, and each line has one positive integer, indicating the number of damaged parts of the robot by those q monsters for one attack. Monsters are expressed in lowercase letters which are formed as a sequential increase from latter "a" to the letter "z". For example, when q = 10, then the names of the monsters are a, b, c, d, e, f, g, h, i, j, then the 10 lines of positive integers are the number of destroyed parts of robot as the result of the attack of those 10 monsters. Finally, there are k * n lines, every n lines indicates a floor of the ship, each line has m characters. The K floors are given from high to low. Input is terminated by the end of the file. Output For Each test case, if it can arrive "E" place, then output "Yes", or output "No". Each output takes up one line. Sample Input 1 5 10 0 0 ＃＃＃＃＃＃＃＃＃＃ ＃Ｓ ＃Ｋ ＃ Ｅ＃ ＃ ＃Ｋ ＃ ＃ ＃ Ｄ Ｄ ＃ ＃＃＃＃＃＃＃＃＃＃ 3 5 10 1 1 10 3 1 2 3 ＃＃＃＃＃＃＃＃＃＃ ＃ ＃ａＫＫＫＫ＃ ＃ＬＫＤｃＫＫＫＫ＃ ＃＃＃＃ｂＫＫＫＫ＃ ＃＃＃＃＃＃＃＃＃＃ ＃＃＃＃＃＃＃＃＃＃ ＃ ＤＬ Ｋ＃ ＃Ｈ ＃＃＃＃＃＃＃ ＃ Ｄ Ｄ Ｅ＃ ＃＃＃＃＃＃＃＃＃＃ ＃＃＃＃＃＃＃＃＃＃ ＃ ＃ ＃ Ｈ ＃ ＃ Ｓ ＃ ＃＃＃＃＃＃＃＃＃＃ Sample Output No Yes
Treasure of the Chimp Island_course
20190915Problem Description Bob Bennett, the young adventurer, has found the map to the treasure of the Chimp Island, where the ghost zombie pirate LeChimp, the infamous evil pirate of the Caribbeans has hidden somewhere inside the Zimbu Memorial Monument (ZM2). ZM2 is made up of a number of corridors forming a maze. To protect the treasure, LeChimp has placed a number of stone blocks inside the corridors to block the way to the treasure. The map shows the hardness of each stone block which determines how long it takes to destroy the block. ZM2 has a number of gates on the boundary from which Bob can enter the corridors. Fortunately, there may be a pack of dynamites at some gates, so that if Bob enters from such a gate, he may take the pack with him. Each pack has a number of dynamites that can be used to destroy the stone blocks in a much shorter time. Once entered, Bob cannot exit ZM2 and enter again, nor can he walk on the area of other gates (so, he cannot pick more than one pack of dynamites). The hardness of the stone blocks is an integer between 1 and 9, showing the number of days required to destroy the block. We neglect the time required to travel inside the corridors. Using a dynamite, Bob can destroy a block almost immediately, so we can ignore the time required for it too. The problem is to find the minimum time at which Bob can reach the treasure. He may choose any gate he wants to enter ZM2. Input The input consists of multiple test cases. Each test case contains the map of ZM2 viewed from the above. The map is a rectangular matrix of characters. Bob can move in four directions up, down, left, and right, but cannot move diagonally. He cannot enter a location shown by asterisk characters (*), even using all his dynamites! The character ($) shows the location of the treasure. A digit character (between 1 and 9) shows a stone block of hardness equal to the value of the digit. A hash sign (#) which can appear only on the boundary of the map indicates a gate without a dynamite pack. An uppercase letter on the boundary shows a gate with a pack of dynamites. The letter A shows there is one dynamite in the pack, B shows there are two dynamite in the pack and so on. All other characters on the boundary of the map are asterisks. Corridors are indicated by dots (.). There is a blank line after each test case. The width and the height of the map are at least 3 and at most 100 characters. The last line of the input contains two dash characters (). Output For each test case, write a single line containing a number showing the minimum number of days it takes Bob to reach the treasure, if possible. If the treasure is unreachable, write IMPOSSIBLE. Sample Input *****#********* *.1....4..$...* *..***..2.....* *..2..*****..2* *..3..******37A *****9..56....* *.....******..* ***CA********** ***** *$3** *.2** ***#*  Sample Output 1 IMPOSSIBLE
 11.19MB
Android支付宝支付demo
20181016快捷简洁的集成了安卓端支付宝支付demo只需三个参数，
21天通关Python（仅视频课）
20190521本页面购买不发书！！！仅为视频课购买！！！ 请务必到https://edu.csdn.net/bundled/detail/49下单购买课+书。 本页面，仅为观看视频页面，如需一并购买图书，请务必到https://edu.csdn.net/bundled/detail/49下单购买课程+图书！！！ 疯狂Python精讲课程覆盖《疯狂Python讲义》全书的主体内容。 内容包括Python基本数据类型、Python列表、元组和字典、流程控制、函数式编程、面向对象编程、文件读写、异常控制、数据库编程、并发编程与网络编程、数据可视化分析、Python爬虫等。 全套课程从Python基础开始介绍，逐步步入当前就业热点。将会带着大家从Python基础语法开始学习，为每个知识点都提供对应的代码实操、代码练习，逐步过渡到文件IO、数据库编程、并发编程、网络编程、数据分 析和网络爬虫等内容，本课程会从小案例起，至爬虫、数据分析案例终、以Python知识体系作为内在逻辑，以Python案例作为学习方式，最终达到“知行合一”。
 373KB
2020数学建模A题
202009112020数学建模国赛A题及其数据 2020数学建模国赛A题及其数据2020数学建模国赛A题及其数据 2020数学建模国赛A题及其数据 2020数学建模国赛A题及其数据 2020数学建模国赛A题及其数据
Java学习指南（Java入门与进阶）
20170809这是Java学习指南系列课程的第1篇，介绍Java语言的入门语法，引领希望学习Java语言编程的初学者进入Java大门。 本课程不需要其他语言作为基础，可以直接学习。 课程从Java开发平台的下载和安装开始，从浅到深、从易到难，循序渐进地进行语法讲解。 为了让学员更好的掌握Java语言，本课程配套在线的Java题库及答案解析。 相比于其他语言，Java语言更科学、更容易掌握，快来和大家一起学习Java吧。
 42KB
81个Python爬虫源代码
2018121381个Python爬虫源代码，内容包含新闻、视频、中介、招聘、图片资源等网站的爬虫资源
Google开发专家带你入门神经网络
20200609限时秒杀，先到先得！！！ 购买后添加“助手小姐姐”微信，还可有不定期直播活动和老师答疑哦！ 【授课老师】 彭靖田 Google Developer Experts。 曾为 TensorFlow Top 40 的贡献者，著书《深入理解TensorFlow》，是国内第一本深度剖析 Google AI 框架的畅销书。 曾从0到1深入参与了华为 2012 实验室深度学习平台和华为深度学习云服务的设计与研发工作。 【课程会讲哪些知识？】 整个课程以理论加实战为核心，通过从基础原理、代码案例带你手把手入门神经网络。下面是课程的知识概览思维导图。
 71.49MB
jboss4.2.3.GA
20190327此版本在其余地方已经下载不到了哟，但是这个版本还是很好的，jboss4.2.3.GA,此jboss支持jboss 4.x 开发，jdk需满足5.0及以上的版本，不然会运行出错的，需要的自行下载哈，无
 41.83MB
Python高级编程.pdf
20130801《Python高级编程》通过大量的实例，介绍了Python语言的最佳实践和敏捷开发方法，并涉及整个软件生命周期的高级主题，诸如持续集成、版本控制系统、包的发行和分发、开发模式、文档编写等。《Pytho
微信公众平台开发入门
20150106本套课程的设计完全是为初学者量身打造，课程内容由浅入深，课程讲解通俗易懂，代码实现简洁清晰。通过本课程的学习，学员能够入门微信公众平台开发，能够胜任企业级的订阅号、服务号、企业号的应用开发工作。 通过本课程的学习，学员能够对微信公众平台有一个清晰的、系统性的认识。例如，公众号是什么，它有什么特点，它能做什么，怎么开发公众号。 其次，通过本课程的学习，学员能够掌握微信公众平台开发的方法、技术和应用实现。例如，开发者文档怎么看，开发环境怎么搭建，基本的消息交互如何实现，常用的方法技巧有哪些，真实应用怎么开发。
SpringCloud微服务轻松入门
20200223[为什么要学习Spring Cloud微服务] SpringCloud作为主流微服务框架，已成为各互联网公司的首选框架，国内外企业占有率持续攀升，是Java工程师的必备技能。就连大名鼎鼎的阿里巴巴dubbo也正式更名为Spring Cloud Alibaba，成为了Spring Cloud 微服务中的一个子模块。Spring Cloud是企业架构转型、个人能力提升、架构师进阶的不二选择。 【推荐你学习这门课的理由】 1、本课程总计29课时，从微服务是什么、能够做什么开始讲起，绝对的零基础入门 2、课程附带全部26个项目源码，230页高清PDF正版课件 【课程知识梳理】 1、先讲解了什么是单体架构、什么是微服务架构、他们之间有什么区别和联系，各自有什么优缺点。 2、从本质入手，使用最简单的Spring Boot搭建微服务，让你认清微服务是一种思想和解决问题的手段，而不是新兴技术。 3、讲解Spring Boot 与Spring Cloud 微服务架构之间的联系，原生的RestTemplate工具，以及Actuator监控端点的使用。 4、带着微服务所带来的各种优缺点，为大家引入服务发现与注册的概念和原理，从而引入我们的第一个注册中心服务Eureka。 5、引入负载均衡的理念，区分什么是服务端负载均衡，什么是客户端负载均衡，进而引入Ribbon负载均衡组件的详细使用。 6、为了解决微服务之间复杂的调用，降低代码的复杂度，我们引入了Feign声明式客户端，让你几行代码搞定服务的远程调用。 7、最后为大家介绍了整个微服务体系应该包含什么，学习路线是什么，应该学习什么。 【学习方法】 每一节课程均有代码，最好的方式是静下心来，用一天的时间，或者两个半天时间来学习。 一边听我的讲解，一边使用我提供的项目代码进行观察和运行。 只要你能跟住我的节奏，你就可以搞定微服务。
 24.46MB
图书管理系统（Java + Mysql）我的第一个完全自己做的实训项目
20190104图书管理系统 Java + MySQL 完整实训代码，MVC三层架构组织，包含所有用到的图片资源以及数据库文件，大三上学期实训，注释很详细，按照阿里巴巴Java编程规范编写
 35.81MB
navicat简体中文版 绿色版 （64位）
20160923解压后安装navicat，打开navicat执行PatchNavicat即破解成功。可以正常使用啦。
 下载 分享别人写的一个小型js框架
 博客 Cobalt Strike 4.0系列（三）  主机上线
 学院 覃超老师带你玩转数据结构与算法
 下载 用javascript实现给图片加链接
 下载 用javascript实现计算两个日期的间隔天数
 下载 完美解决Could not load file or assembly AjaxPro.2 or one of its dependencies. 拒绝访问。 <font color=red>原创</
 下载 JavaScript 模仿vbs中的 DateAdd() 函数的代码
 下载 免费分享！4张精品知识脑图，打开网盘即可下载
 学院 C#之高级进阶
 学院 全新Vue3.0全家桶 零基础入门到项目实战
 下载 CSS bordercollapse 属性
 学院 Spring Boot2.x从青铜到王者分布式事务MInIO等技术
 博客 面试题 17.04. 消失的数字
 博客 易出错 遗漏“switch” 与遗漏“负数”的判断
 博客 希尔排序(C++)
 博客 网安上课打卡day02
 学院 uniapp基础入门到精通知识点精讲(第一季)
 下载 dex2jar_luyten_apktool.zip
 下载 让回调函数 showResponse 也带上参数的代码
 博客 JDK11新特性学习（一）
 学院 FFmpeg4.3开发系列之三：流媒体直播基础理论
 博客 【推荐系统】GBDT+LR
 博客 2020年金属非金属矿山（露天矿山）主要负责人新版试题及金属非金属矿山（露天矿山）主要负责人操作证考试
 下载 超强推荐的js编程中的简洁写法收集
 博客 推荐系统知识梳理——GBDT&LR
 学院 Cocos Creator 飞机大战微信小游戏开发
 博客 在vue+ts中使用echarts
 下载 aspupload文件重命名及上传进度条的解决方法附代码第1/2页
 博客 UltraEdit 文本代码程序编辑器免费版下载安装教程
 博客 ES6for循环中setimeout，var与let的区别