Robot Motion 程序的编写的过程

Problem Description

A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructions are

N north (up the page)
S south (down the page)
E east (to the right on the page)
W west (to the left on the page)

For example, suppose the robot starts on the north (top) side of Grid 1 and starts south (down). The path the robot follows is shown. The robot goes through 10 instructions in the grid before leaving the grid.

Compare what happens in Grid 2: the robot goes through 3 instructions only once, and then starts a loop through 8 instructions, and never exits.

You are to write a program that determines how long it takes a robot to get out of the grid or how the robot loops around.

Input
There will be one or more grids for robots to navigate. The data for each is in the following form. On the first line are three integers separated by blanks: the number of rows in the grid, the number of columns in the grid, and the number of the column in which the robot enters from the north. The possible entry columns are numbered starting with one at the left. Then come the rows of the direction instructions. Each grid will have at least one and at most 10 rows and columns of instructions. The lines of instructions contain only the characters N, S, E, or W with no blanks. The end of input is indicated by a row containing 0 0 0.

Output
For each grid in the input there is one line of output. Either the robot follows a certain number of instructions and exits the grid on any one the four sides or else the robot follows the instructions on a certain number of locations once, and then the instructions on some number of locations repeatedly. The sample input below corresponds to the two grids above and illustrates the two forms of output. The word "step" is always immediately followed by "(s)" whether or not the number before it is 1.

Sample Input
3 6 5
NEESWE
WWWESS
SNWWWW
4 5 1
SESWE
EESNW
NWEEN
EWSEN
0 0

Sample Output
10 step(s) to exit
3 step(s) before a loop of 8 step(s)

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Robot Motion 编写和解决
Problem Description A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructions are N north (up the page) S south (down the page) E east (to the right on the page) W west (to the left on the page) For example, suppose the robot starts on the north (top) side of Grid 1 and starts south (down). The path the robot follows is shown. The robot goes through 10 instructions in the grid before leaving the grid. Compare what happens in Grid 2: the robot goes through 3 instructions only once, and then starts a loop through 8 instructions, and never exits. You are to write a program that determines how long it takes a robot to get out of the grid or how the robot loops around. Input There will be one or more grids for robots to navigate. The data for each is in the following form. On the first line are three integers separated by blanks: the number of rows in the grid, the number of columns in the grid, and the number of the column in which the robot enters from the north. The possible entry columns are numbered starting with one at the left. Then come the rows of the direction instructions. Each grid will have at least one and at most 10 rows and columns of instructions. The lines of instructions contain only the characters N, S, E, or W with no blanks. The end of input is indicated by a row containing 0 0 0. Output For each grid in the input there is one line of output. Either the robot follows a certain number of instructions and exits the grid on any one the four sides or else the robot follows the instructions on a certain number of locations once, and then the instructions on some number of locations repeatedly. The sample input below corresponds to the two grids above and illustrates the two forms of output. The word "step" is always immediately followed by "(s)" whether or not the number before it is 1. Sample Input 3 6 5 NEESWE WWWESS SNWWWW 4 5 1 SESWE EESNW NWEEN EWSEN 0 0 Sample Output 10 step(s) to exit 3 step(s) before a loop of 8 step(s)
Special Robot的程序的编写思路
Problem Description Bob invented a special kind of robot controlled by a remote controller. The interesting thing is that the robot can only move in a 2-dimentional plane which is vertical to the ground. Now we assume the vertical plane can be shown in Figure 1. Now Bob wants to conduct a performance for his robot. The situation can be described as follows: n balloons stay still on the ground; all of these balloons have an initial position whose Y-coordinates are 0. Each balloon will move up at certain time. The initial position of the robot is at (0, 0) and if the robot is at position (x, y) at time t, then it can only move to position (x, y-1) or position (x+1, y+1) in a unit time (the robot con not stay still at a position). Its task is to collect as more balloons as possible when it gets to the destination (K,0). When the robot is moving on the plane, balloons are continuously rising on its path from the ground. Each balloon can reach a unit height in a unit time. When the robot meets a balloon, it collects the balloon. The situation can be described as the following three examples which are shown in Figure 2: Example 1: At time t, the robot is at position (x, y), and a balloon is at position (x, y-2). The robot moves down and the balloon moves up; then at time t+1, the robot and the balloon meet at position (x, y-1), so the balloon can be collected by the robot ( which is shown in Figure 2(a)). Example 2: At time t, there is a balloon at position (x, y-1) and the robot stands at position (x, y). Because the balloon always moves up and the robot can move down, so the robot can collect this balloon because they will meet at some point between position (x, y-1) and (x, y) during their movement (which is shown in Figure 2(b)). Example 3: At time t, a balloon is at position (x+1, y) and the robot is at position (x, y). Because the robot can arrive at position (x+1, y+1) while the balloon can move up to the same position, the robot could collect the balloon at time t+1 (which is shown in Figure 2(c)). Maybe it is too easy a problem to control one robot, so Bob intends to control two robots simultaneously. You need to help him to calculate the maximum balloons these two robots can collect when they get to the destination. It is possible that the two robots get to the same position at the same time. Note that one balloon could not be collected by two robots and the balloons staying on the ground could not be collected either. Robot should not move to the underground (y < 0). Input The input contains several cases. For each case, the first line gives the value of n (0 ≤ n ≤ 10,000) and K (1 ≤ K ≤ 100) followed by n lines in which each contains two integers x (1 ≤ x ≤ K) and t (0 ≤ t ≤ 1000). The first integer indicates the position of a balloon and the other indicates the beginning time for it to rise. In the value of n and K, n is the number of balloons and K is the x-coordinate of the destination. The input is ended by two zeros. Output For each case, output the maximum balloons the two robots can collect. Sample Input 3 2 1 1 1 1 1 2 7 4 2 0 2 3 3 4 3 0 3 2 4 0 1 1 0 0 Sample Output 2 6
Robot Motion 编程的技术
Problem Description A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructions are N north (up the page) S south (down the page) E east (to the right on the page) W west (to the left on the page) For example, suppose the robot starts on the north (top) side of Grid 1 and starts south (down). The path the robot follows is shown. The robot goes through 10 instructions in the grid before leaving the grid. Compare what happens in Grid 2: the robot goes through 3 instructions only once, and then starts a loop through 8 instructions, and never exits. You are to write a program that determines how long it takes a robot to get out of the grid or how the robot loops around. Input There will be one or more grids for robots to navigate. The data for each is in the following form. On the first line are three integers separated by blanks: the number of rows in the grid, the number of columns in the grid, and the number of the column in which the robot enters from the north. The possible entry columns are numbered starting with one at the left. Then come the rows of the direction instructions. Each grid will have at least one and at most 10 rows and columns of instructions. The lines of instructions contain only the characters N, S, E, or W with no blanks. The end of input is indicated by a row containing 0 0 0. Output For each grid in the input there is one line of output. Either the robot follows a certain number of instructions and exits the grid on any one the four sides or else the robot follows the instructions on a certain number of locations once, and then the instructions on some number of locations repeatedly. The sample input below corresponds to the two grids above and illustrates the two forms of output. The word "step" is always immediately followed by "(s)" whether or not the number before it is 1. Sample Input 3 6 5 NEESWE WWWESS SNWWWW 4 5 1 SESWE EESNW NWEEN EWSEN 0 0 Sample Output 10 step(s) to exit 3 step(s) before a loop of 8 step(s)
Robot Motion
Problem Description A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructions are N north (up the page) S south (down the page) E east (to the right on the page) W west (to the left on the page) For example, suppose the robot starts on the north (top) side of Grid 1 and starts south (down). The path the robot follows is shown. The robot goes through 10 instructions in the grid before leaving the grid. Compare what happens in Grid 2: the robot goes through 3 instructions only once, and then starts a loop through 8 instructions, and never exits. You are to write a program that determines how long it takes a robot to get out of the grid or how the robot loops around. Input There will be one or more grids for robots to navigate. The data for each is in the following form. On the first line are three integers separated by blanks: the number of rows in the grid, the number of columns in the grid, and the number of the column in which the robot enters from the north. The possible entry columns are numbered starting with one at the left. Then come the rows of the direction instructions. Each grid will have at least one and at most 10 rows and columns of instructions. The lines of instructions contain only the characters N, S, E, or W with no blanks. The end of input is indicated by a row containing 0 0 0. Output For each grid in the input there is one line of output. Either the robot follows a certain number of instructions and exits the grid on any one the four sides or else the robot follows the instructions on a certain number of locations once, and then the instructions on some number of locations repeatedly. The sample input below corresponds to the two grids above and illustrates the two forms of output. The word "step" is always immediately followed by "(s)" whether or not the number before it is 1. Sample Input 3 6 5 NEESWE WWWESS SNWWWW 4 5 1 SESWE EESNW NWEEN EWSEN 0 0 Sample Output 10 step(s) to exit 3 step(s) before a loop of 8 step(s)
Writing Robot的代码的编写
Problem Description Word's combination is an interesting thing. Given a set of words S={s1, s2, ..., sn}, where si is a word only consists lowercase letter and its length is less than 50. When si merges in a text, its effect on reader's mood is both positive and negative. A word's positive effect is measured in love level li and negative effect is in hate level hi. At the same time, given a set paragraph P={P1, P2, ..., Pn} and Pj is a string whose length is less than 1000. For each word si in S, there is two conditions in Pj as follows: Related : si is a substring of Pj, and li units of love level is added to Pj, if si occurs several times in Pj, every occurrence is counted. Unrelated : si never occurs in Pj and this condition bring Pj nothing. Text T is defined as a subset of P. T's love level is defined as sum of Pj's love level where Pj belongs to T minus words?hate level. Because a strange psychology phenomenon, hate level of a word which occurs in T is only counted once no matter how many times it occurs. Given the set of S and P, writing robot's job is to select a subset T to maximum the love level. Input The first line of the input contains a single integer T (1 ≤ T ≤ 15), the number of test cases. Then T cases follow. First line of each case contains 2 integers, S, P. (1≤S, P≤150), then S lines follows, each line contains 2 integers, li, hi, (1≤li≤100, 1≤hi≤1000), and a string si with length less than 50. Next P lines, each contains a string Pi with length less than 1000. It guarantees that the answer will not exceed 32-bit signed integer. Output For the x-th test case, print "Case x: " and maximum T's profit in a line. Sample Input 2 3 2 2 2 hit 1 2 it 3 1 song hitman singasong 2 2 2 3 ab 1 6 ba ababab bababa Sample Output Case 1: 2 Case 2: 6
Robot Navigation 编写思路
Problem Description A robot has been sent to explore a remote planet. To specify a path the robot should take, a program is sent each day. The program consists of a sequence of the following commands: FORWARD X: move forward by X units. TURN LEFT: turn left (in place) by 90 degrees. TURN RIGHT: turn right (in place) by 90 degrees. The robot also has sensor units which allow it to obtain a map of its surrounding area. The map is represented as a grid. Some grid points contain hazards (e.g. craters) and the program must avoid these points or risk losing the robot. Naturally, if the initial location of the robot, the direction it is facing, and its destination position are known, it is best to send the shortest program (one consisting of the fewest commands) to move the robot to its destination (we do not care which direction it faces at the destination). You are more interested in knowing the number of different shortest programs that can move the robot to its destination. However, the number of shortest programs can be very large, so you are satisfied to compute the number as a remainder modulo 1,000,000. Input There will be several test cases in the input. Each test case will begin with a line with two integers N M Where N is the number of rows in the grid, and M is the number of columns in the grid (2 ≤ N, M ≤ 100). The next N lines of input will have M characters each. The characters will be one of the following: ‘.’ Indicating a navigable grid point. ‘*’ Indicating a crater (i.e. a non-navigable grid point). ‘X’ Indicating the target grid point. There will be exactly one ‘X’. ‘N’, ‘E’, ‘S’, or ‘W’ Indicating the starting point and initial heading of the robot. There will be exactly one of these. Note that the directions mirror compass directions on a map: N is North (toward the top of the grid), E is East (toward the right of the grid), S is South (toward the bottom of the grid) and W is West (toward the left of the grid). There will be no spaces and no other characters in the description of the map. The input will end with a line with two 0s. Output For each test case, output two integers on a single line, with a single space between them. The first is the length of a shortest possible program to navigate the robot from its starting point to the target, and the second is the number of different programs of that length which will get the robot to the target (modulo 1,000,000). If there is no path from the robot to the target, output two zeros separated by a single space. Output no extra spaces, and do not separate answers with blank lines. Sample Input 5 6 *....X .....* .....* .....* N....* 6 5 ....X .**** .**** .**** .**** N**** 3 3 .E. *** .X. 0 0 Sample Output 6 4 3 1 0 0
Robot Navigation 罗伯特的导航
Problem Description A robot has been sent to explore a remote planet. To specify a path the robot should take, a program is sent each day. The program consists of a sequence of the following commands: FORWARD X: move forward by X units. TURN LEFT: turn left (in place) by 90 degrees. TURN RIGHT: turn right (in place) by 90 degrees. The robot also has sensor units which allow it to obtain a map of its surrounding area. The map is represented as a grid. Some grid points contain hazards (e.g. craters) and the program must avoid these points or risk losing the robot. Naturally, if the initial location of the robot, the direction it is facing, and its destination position are known, it is best to send the shortest program (one consisting of the fewest commands) to move the robot to its destination (we do not care which direction it faces at the destination). You are more interested in knowing the number of different shortest programs that can move the robot to its destination. However, the number of shortest programs can be very large, so you are satisfied to compute the number as a remainder modulo 1,000,000. Input There will be several test cases in the input. Each test case will begin with a line with two integers N M Where N is the number of rows in the grid, and M is the number of columns in the grid (2 ≤ N, M ≤ 100). The next N lines of input will have M characters each. The characters will be one of the following: ‘.’ Indicating a navigable grid point. ‘*’ Indicating a crater (i.e. a non-navigable grid point). ‘X’ Indicating the target grid point. There will be exactly one ‘X’. ‘N’, ‘E’, ‘S’, or ‘W’ Indicating the starting point and initial heading of the robot. There will be exactly one of these. Note that the directions mirror compass directions on a map: N is North (toward the top of the grid), E is East (toward the right of the grid), S is South (toward the bottom of the grid) and W is West (toward the left of the grid). There will be no spaces and no other characters in the description of the map. The input will end with a line with two 0s. Output For each test case, output two integers on a single line, with a single space between them. The first is the length of a shortest possible program to navigate the robot from its starting point to the target, and the second is the number of different programs of that length which will get the robot to the target (modulo 1,000,000). If there is no path from the robot to the target, output two zeros separated by a single space. Output no extra spaces, and do not separate answers with blank lines. Sample Input 5 6 *....X .....* .....* .....* N....* 6 5 ....X .**** .**** .**** .**** N**** 3 3 .E. *** .X. 0 0 Sample Output 6 4 3 1 0 0
Robot 罗伯特问题
Problem Description Michael has a telecontrol robot. One day he put the robot on a loop with n cells. The cells are numbered from 1 to n clockwise. At first the robot is in cell 1. Then Michael uses a remote control to send m commands to the robot. A command will make the robot walk some distance. Unfortunately the direction part on the remote control is broken, so for every command the robot will chose a direction(clockwise or anticlockwise) randomly with equal possibility, and then walk w cells forward. Michael wants to know the possibility of the robot stopping in the cell that cell number >= l and <= r after m commands. Input There are multiple test cases. Each test case contains several lines. The first line contains four integers: above mentioned n(1≤n≤200) ,m(0≤m≤1,000,000),l,r(1≤l≤r≤n). Then m lines follow, each representing a command. A command is a integer w(1≤w≤100) representing the cell length the robot will walk for this command. The input end with n=0,m=0,l=0,r=0. You should not process this test case. Output For each test case in the input, you should output a line with the expected possibility. Output should be round to 4 digits after decimal points. Sample Input 3 1 1 2 1 5 2 4 4 1 2 0 0 0 0 Sample Output 0.5000 0.2500
Find Metal Mineral 程序的编写
Problem Description Humans have discovered a kind of new metal mineral on Mars which are distributed in point‐like with paths connecting each of them which formed a tree. Now Humans launches k robots on Mars to collect them, and due to the unknown reasons, the landing site S of all robots is identified in advanced, in other word, all robot should start their job at point S. Each robot can return to Earth anywhere, and of course they cannot go back to Mars. We have research the information of all paths on Mars, including its two endpoints x, y and energy cost w. To reduce the total energy cost, we should make a optimal plan which cost minimal energy cost. Input There are multiple cases in the input. In each case: The first line specifies three integers N, S, K specifying the numbers of metal mineral, landing site and the number of robots. The next n‐1 lines will give three integers x, y, w in each line specifying there is a path connected point x and y which should cost w. 1<=N<=10000, 1<=S<=N, 1<=k<=10, 1<=x, y<=N, 1<=w<=10000. Output For each cases output one line with the minimal energy cost. Sample Input 3 1 1 1 2 1 1 3 1 3 1 2 1 2 1 1 3 1 Sample Output 3 2
Jumping Robot 跳跃的罗伯特
Problem Description Ali invents a jumping robot. This robot is controlled by a program {Di}, which is a finite sequence of non-negative “jumping distances”. The program can’t be changed once the robot is made. There are L boxes in a line. Each time the robot is placed in one of the boxes, facing left or right, and then it is turned on. It first jumps over D1 boxes, then jumps over D2 boxes ... Ali writes a capital letter in each box. The robot prints out all the letter it touches, including the initial one. Now he wants to design a program with a length of p, so that for every kind of letters in the boxes, if you carefully choose the initial position and direction of the robot, it can print out a sequence of that letter of length p. What’s the maximum possible p for the given letters in boxes? Input The input consists several testcases. The first line contains 2 integers n (4 <= n <= 8) and L (4 <= L <= 100), represents the number of different capital letters and the number of boxes. The second line contains a string whose length is exactly L, represents the letters in each box. The string only contains the first n capital letters, and each letter appears at least once in the string. Output Print an integer, the maximum length of the jumping program. Sample Input 4 15 DABCDDCCBAACBBA Sample Output 3
Robot Navigation 罗伯特的导航问题
Problem Description A robot has been sent to explore a remote planet. To specify a path the robot should take, a program is sent each day. The program consists of a sequence of the following commands: FORWARD X: move forward by X units. TURN LEFT: turn left (in place) by 90 degrees. TURN RIGHT: turn right (in place) by 90 degrees. The robot also has sensor units which allow it to obtain a map of its surrounding area. The map is represented as a grid. Some grid points contain hazards (e.g. craters) and the program must avoid these points or risk losing the robot. Naturally, if the initial location of the robot, the direction it is facing, and its destination position are known, it is best to send the shortest program (one consisting of the fewest commands) to move the robot to its destination (we do not care which direction it faces at the destination). You are more interested in knowing the number of different shortest programs that can move the robot to its destination. However, the number of shortest programs can be very large, so you are satisfied to compute the number as a remainder modulo 1,000,000. Input There will be several test cases in the input. Each test case will begin with a line with two integers N M Where N is the number of rows in the grid, and M is the number of columns in the grid (2 ≤ N, M ≤ 100). The next N lines of input will have M characters each. The characters will be one of the following: ‘.’ Indicating a navigable grid point. ‘*’ Indicating a crater (i.e. a non-navigable grid point). ‘X’ Indicating the target grid point. There will be exactly one ‘X’. ‘N’, ‘E’, ‘S’, or ‘W’ Indicating the starting point and initial heading of the robot. There will be exactly one of these. Note that the directions mirror compass directions on a map: N is North (toward the top of the grid), E is East (toward the right of the grid), S is South (toward the bottom of the grid) and W is West (toward the left of the grid). There will be no spaces and no other characters in the description of the map. The input will end with a line with two 0s. Output For each test case, output two integers on a single line, with a single space between them. The first is the length of a shortest possible program to navigate the robot from its starting point to the target, and the second is the number of different programs of that length which will get the robot to the target (modulo 1,000,000). If there is no path from the robot to the target, output two zeros separated by a single space. Output no extra spaces, and do not separate answers with blank lines. Sample Input 5 6 *....X .....* .....* .....* N....* 6 5 ....X .**** .**** .**** .**** N**** 3 3 .E. *** .X. 0 0 Sample Output 6 4 3 1 0 0
Robot Encryption 加密的问题
Problem Description Due to suspicion of cheaters, one of the more paranoid problem setters has started encrypting all messages to the rest of the jury before sending them. He didn't use any standard encryption, however, as he believes those are all part of a giant conspiracy network trying to crush IDI Open from the inside. Instead, he based it on the fact that the cheaters are likely to be the worst programmers. The decryption requires some programming skill, and should therefore be safe. Along with the encrypted message, he sent explanation of how to decrypt it. The only problem now is that not all jury members are able to implement the decryption. This is where we need your help. You need to help us decrypt these messages by writing a program that does the task. Decryption is performed by simulating a robots movement on a grid. The robot is initially placed in the north-west corner of the grid, facing south. The robot is a simple one, and only accepts three dierent commands: L turns the robot 90 angle to the left. R turns the robot 90 angle to the right. F moves the robot one square forward. If moving forward would cause the robot to fall of the grid, the robot instead makes a 180 angle turn without moving. Instructions to the robot is given in a series of commandsets. A commandset is a string of commands, with the possible addition of loops. A loop is given on the form "(commandset)number" where number is the number of times the commandset inside the parentheses should be run. Longer sequences of commands can be built up recursively in this fashion. More formally: commandset ::= instruction+ instruction ::= command | loop loop ::= "(" commandset ")" number command ::= R | L | F number ::= 1 |2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 The decrypted text is the text string obtained by concatenating the characters on the grid positions the robot stands on after executing each commandline. Input The first line of input gives T, the number of test scenarios. Each scenario starts with a line containing W and H, separated by a single space, describing the dimensions of the grid. Then follows H lines, each consisting of W characters, making up the grid. After this comes a line containing N, the number of commandlines, followed by the N lines the robot will be executing. Output One line per test scenario, containing the decrypted text. Notes and Constraints 0 < T <= 100 0 < W <= 50 0 < H <= 50 0 < N <= 20 Commandlines will be no longer than 50 characters, and will follow the syntax given in the problem text. No character with ASCII value lower than 32 or higher than 126 will appear on the robots grid. Sample Input 1 6 7 012345 6789AB CDEFGH IJKLMN OPQRST UVWXYZ _! .,& 12 FFL(F)5 (F)4 (LF)2 (L(R)6L)9 RFRFFF (L(F)2)2 LF FLFF FFFF LF FLFF L(F)4 Sample Output HELLO WORLD!
JAVA使用robot类进行编写线程,如何正确的终止(其中会使用到ROBOT.DEALY())
在进行学习时,发现自己用robot类写鼠标点击事件的循环,然后以线程的方式进行运行,但是如果想要正确的终止,一般应该使用interrupt,但是如果在main函数中对这个线程进行interrupt,会抛出无法捕获的interruptexception(因为里面并没有使用sleep方法),while循环进行判断时可能是robot报错之后会将interrupt标志位重置,导致死循环,求解决或说明 代码如下 public class Click_Thread implements Runnable { public void run() { try { Robot robot = new Robot(); while(!Thread.currentThread().isInterrupted()) { movemouse(robot, 1421,456); pressmouseleft(robot); robot.delay(1000); movemouse(robot, 1000, 494); pressmouseleft(robot); robot.delay(1000); movemouse(robot, 1166, 635); pressmouseleft(robot); robot.delay(1000); } } catch (Exception e) { // TODO Auto-generated catch block System.out.println("捕获异常"); e.printStackTrace(); } System.out.println("????"); } private static void movemouse(Robot robot,int x,int y) { robot.mouseMove(x,y); robot.delay(500); } private static void pressmouseleft(Robot robot) { robot.mousePress(InputEvent.BUTTON1_MASK); robot.delay(10); robot.mouseRelease(InputEvent.BUTTON1_MASK); robot.delay(500); } 这个是那个线程类,然后用一个主函数启动
Java 中Robot类的mouseMove不能正确移动
前一天还好的,第二天发现 只运行到以一个move,打开了其他软件的界面,然后鼠标就不动了,我手动点回Eclipse界面,鼠标又开始继续执行了 ``` robot = new Robot(); //点开了另一个软件然后鼠标就一直停留在这 robot.mouseMove(513, 1060); robot.delay(500); robot.mousePress(KeyEvent.BUTTON1_DOWN_MASK); robot.mouseRelease(KeyEvent.BUTTON1_DOWN_MASK); robot.delay(500); -----到这里鼠标就不会移动了 robot.mouseMove(972, 35); robot.delay(500); robot.mousePress(KeyEvent.BUTTON1_DOWN_MASK); robot.mouseRelease(KeyEvent.BUTTON1_DOWN_MASK); robot.delay(500); ``` 然后我在第二个move下加了个输出,发现已经执行了,但鼠标位置没变 后来试了下,在MyEclipse界面能够正常移动,切换到其他界面就出现上述情况
Searching Treasure in Deep Sea 深度搜索
Problem Description A deep-sea salvage company found out that there was a sunken ship in some deep-sea 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 re-load 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 re-load 2 bullets when it launches an attack. In the same room, the robot will repair 10 damaged parts of the body surface and re-filled 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 deep-sea 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 deep-sea 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 ########## #S #K # E# #  #K #  # #  D  D  # ########## 3 5 10 1 1 10 3 1 2 3 ########## #  #aKKKK# #LKDcKKKK# ####bKKKK# ########## ########## #    DL K# #H ####### #  D  D E# ########## ########## #        # #  H     # #  S     # ########## Sample Output No Yes
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私有的数
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
此博客仅为我业余记录文章所用,发布到此,仅供网友阅读参考,如有侵权,请通知我,我会删掉。 补充 有不少读者留言说本文章没有用,因为天气预报直接打开手机就可以收到了,为何要多此一举发送到邮箱呢!!!那我在这里只能说:因为你没用,所以你没用!!! 这里主要介绍的是思路,不是天气预报!不是天气预报!!不是天气预报!!!天气预报只是用于举例。请各位不要再刚了!!! 下面是我会用到的两个场景: 每日下
面试官问我:什么是消息队列?什么场景需要他?用了会出现什么问题?
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸,打败了无数
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观
MyBatis研习录(01)——MyBatis概述与入门
C语言自学完备手册(33篇) Android多分辨率适配框架 JavaWeb核心技术系列教程 HTML5前端开发实战系列教程 MySQL数据库实操教程(35篇图文版) 推翻自己和过往——自定义View系列教程(10篇) 走出思维困境,踏上精进之路——Android开发进阶精华录 讲给Android程序员看的前端系列教程(40集免费视频教程+源码) 版权声明 本文原创作者:谷哥的小弟 作者博客
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip install selenium -i https://pypi.tuna.tsinghua.edu.cn/simple/ 
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
你知道的越多,你不知道的越多 点赞再看,养成习惯 本文 GitHub https://github.com/JavaFamily 已收录,有一线大厂面试点思维导图,也整理了很多我的文档,欢迎Star和完善,大家面试可以参照考点复习,希望我们一起有点东西。 前前言 为啥今天有个前前言呢? 因为你们的丙丙啊,昨天有牌面了哟,直接被微信官方推荐,知乎推荐,也就仅仅是还行吧(心里乐开花)
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca
Python爬虫精简步骤1 获取数据
爬虫的工作分为四步: 1.获取数据。爬虫程序会根据我们提供的网址,向服务器发起请求,然后返回数据。 2.解析数据。爬虫程序会把服务器返回的数据解析成我们能读懂的格式。 3.提取数据。爬虫程序再从中提取出我们需要的数据。 4.储存数据。爬虫程序把这些有用的数据保存起来,便于你日后的使用和分析。 这一篇的内容就是:获取数据。 首先,我们将会利用一个强大的库——requests来获取数据。 在电脑上安装
Python绘图,圣诞树,花,爱心 | Turtle篇
1.画圣诞树 import turtle screen = turtle.Screen() screen.setup(800,600) circle = turtle.Turtle() circle.shape('circle') circle.color('red') circle.speed('fastest') circle.up() square = turtle.Turtle()
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东
破14亿,Python分析我国存在哪些人口危机!
2020年1月17日,国家统计局发布了2019年国民经济报告,报告中指出我国人口突破14亿。 猪哥的朋友圈被14亿人口刷屏,但是很多人并没有看到我国复杂的人口问题:老龄化、男女比例失衡、生育率下降、人口红利下降等。 今天我们就来分析一下我们国家的人口数据吧! 更多有趣分析教程,扫描下方二维码关注vx公号「裸睡的猪」 即可查看! 一、背景 1.人口突破14亿 2020年1月17日,国家统计局发布
web前端javascript+jquery知识点总结
Javascript javascript 在前端网页中占有非常重要的地位,可以用于验证表单,制作特效等功能,它是一种描述语言,也是一种基于对象(Object)和事件驱动并具有安全性的脚本语言 ,语法同java类似,是一种解释性语言,边执行边解释。 JavaScript的组成: ECMAScipt 用于描述: 语法,变量和数据类型,运算符,逻辑控制语句,关键字保留字,对象。 浏览器对象模型(Br
Python实战:抓肺炎疫情实时数据,画2019-nCoV疫情地图
文章目录1. 前言2. 数据下载3. 数据处理4. 数据可视化 1. 前言 今天,群里白垩老师问如何用python画武汉肺炎疫情地图。白垩老师是研究海洋生态与地球生物的学者,国家重点实验室成员,于不惑之年学习python,实为我等学习楷模。先前我并没有关注武汉肺炎的具体数据,也没有画过类似的数据分布图。于是就拿了两个小时,专门研究了一下,遂成此文。 2月6日追记:本文发布后,腾讯的数据源多次变更u
听说想当黑客的都玩过这个Monyer游戏(1~14攻略)
第零关 进入传送门开始第0关(游戏链接) 请点击链接进入第1关: 连接在左边→ ←连接在右边 看不到啊。。。。(只能看到一堆大佬做完的留名,也能看到菜鸡的我,在后面~~) 直接fn+f12吧 &lt;span&gt;连接在左边→&lt;/span&gt; &lt;a href="first.php"&gt;&lt;/a&gt; &lt;span&gt;←连接在右边&lt;/span&gt; o
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ......
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!
渗透测试-灰鸽子远控木马
木马概述 灰鸽子( Huigezi),原本该软件适用于公司和家庭管理,其功能十分强大,不但能监视摄像头、键盘记录、监控桌面、文件操作等。还提供了黑客专用功能,如:伪装系统图标、随意更换启动项名称和表述、随意更换端口、运行后自删除、毫无提示安装等,并采用反弹链接这种缺陷设计,使得使用者拥有最高权限,一经破解即无法控制。最终导致被黑客恶意使用。原作者的灰鸽子被定义为是一款集多种控制方式于一体的木马程序
Python:爬取疫情每日数据
前言 有部分同学留言说为什么412,这是因为我代码里全国的cookies需要你自己打开浏览器更新好后替换,而且这个cookies大概只能持续20秒左右! 另外全国卫健委的数据格式一直在变,也有可能会导致爬取失败! 我现在已根据2月14日最新通报稿的格式修正了! 目前每天各大平台,如腾讯、今日头条都会更新疫情每日数据,他们的数据源都是一样的,主要都是通过各地的卫健委官网通报。 为什么已经有大量平台做
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。   再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。   下文是原回答,希望能对你能有所启发。   如果我说,这个世界上人真的分三六九等,
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合
雷火神山直播超两亿,Web播放器事件监听是怎么实现的?
Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题,让视音频内容可以不依赖用户安装App,就能进行播放以及在社交平台进行传播。在视频业务大数据平台中,播放数据的统计分析非常重要,所以Web播放器在使用过程中,需要对其内部的数据进行收集并上报至服务端,此时,就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢? 01 监听事件明细表 名
3万字总结,Mysql优化之精髓
本文知识点较多,篇幅较长,请耐心学习 MySQL已经成为时下关系型数据库产品的中坚力量,备受互联网大厂的青睐,出门面试想进BAT,想拿高工资,不会点MySQL优化知识,拿offer的成功率会大大下降。 为什么要优化 系统的吞吐量瓶颈往往出现在数据库的访问速度上 随着应用程序的运行,数据库的中的数据会越来越多,处理时间会相应变慢 数据是存放在磁盘上的,读写速度无法和内存相比 如何优化 设计
Python新型冠状病毒疫情数据自动爬取+统计+发送报告+数据屏幕(三)发送篇
今天介绍的项目是使用 Itchat 发送统计报告 项目功能设计: 定时爬取疫情数据存入Mysql 进行数据分析制作疫情报告 使用itchat给亲人朋友发送分析报告(本文) 基于Django做数据屏幕 使用Tableau做数据分析 来看看最终效果 目前已经完成,预计2月12日前更新 使用 itchat 发送数据统计报告 itchat 是一个基于 web微信的一个框架,但微信官方并不允
作为程序员的我,大学四年一直自学,全靠这些实用工具和学习网站!
我本人因为高中沉迷于爱情,导致学业荒废,后来高考,毫无疑问进入了一所普普通通的大学,实在惭愧...... 我又是那么好强,现在学历不行,没办法改变的事情了,所以,进入大学开始,我就下定决心,一定要让自己掌握更多的技能,尤其选择了计算机这个行业,一定要多学习技术。 在进入大学学习不久后,我就认清了一个现实:我这个大学的整体教学质量和学习风气,真的一言难尽,懂的人自然知道怎么回事? 怎么办?我该如何更好的提升
粒子群算法求解物流配送路线问题(python)
粒子群算法求解物流配送路线问题(python) 1.查找论文文献 找一篇物流配送路径优化+粒子群算法求解的论文 参考文献:基于混沌粒子群算法的物流配送路径优化 2.了解粒子群算法的原理 讲解通俗易懂,有数学实例的博文:https://blog.csdn.net/daaikuaichuan/article/details/81382794 3.确定编码方式和解码策略 3.1编码方式 物流配送路线的
教你如何编写第一个简单的爬虫
很多人知道爬虫,也很想利用爬虫去爬取自己想要的数据,那么爬虫到底怎么用呢?今天就教大家编写一个简单的爬虫。 下面以爬取笔者的个人博客网站为例获取第一篇文章的标题名称,教大家学会一个简单的爬虫。 第一步:获取页面 #!/usr/bin/python # coding: utf-8 import requests #引入包requests link = "http://www.santostang.
前端JS初级面试题二 (。•ˇ‸ˇ•。)老铁们!快来瞧瞧自己都会了么
1. 传统事件绑定和符合W3C标准的事件绑定有什么区别? 传统事件绑定 &lt;div onclick=""&gt;123&lt;/div&gt; div1.onclick = function(){}; &lt;button onmouseover=""&gt;&lt;/button&gt; 注意: 如果给同一个元素绑定了两次或多次相同类型的事件,那么后面的绑定会覆盖前面的绑定 (不支持DOM事...
情人节来了,教你个用 Python 表白的技巧
作者:@明哥 公众号:Python编程时光 2020年,这个看起来如此浪漫的年份,你还是一个人吗? 难不成我还能是一条狗? 18年的时候,写过一篇介绍如何使用 Python 来表白的文章。 虽然创意和使用效果都不错,但有一缺点,这是那个exe文件,女神需要打开电脑,才有可能参与进来,进而被你成功"调戏”。 由于是很早期的文章了,应该有很多人没有看过。 没有看过的,你可以点击这里查看:用Pyt...
用Python开发实用程序 – 计算器
作者:隋顺意 一段时间前,自己制作了一个库 “sui-math”。这其实是math的翻版。做完后,python既然可以轻易的完成任何的数学计算,何不用python开发一个小程序专门用以计算呢? 现在我们越来越依赖于计算器,很多复杂的计算都离不开它。我们使用过各式各样的计算器,无论是电脑自带的,还是网也上的计算器,却都没有自己动手编写属于自己计算器。今天就让我们走进计算器的世界,用python来编写...
经典算法(19)教你两分钟学会【选择排序】
这篇博客使用图文并茂的方式讲解选择排序算法,并有完整的算法逻辑以及代码实现。
Python学习笔记(语法篇)
本篇博客大部分内容摘自埃里克·马瑟斯所著的《Python编程:从入门到实战》(入门类书籍),采用举例的方式进行知识点提要 关于Python学习书籍推荐文章 《学习Python必备的8本书》 Python语法特点: 通过缩进进行语句组织 不需要变量或参数的声明 冒号 1 变量和简单数据结构 1.1 变量命名 只能包含字母、数字和下划线,且不能以数字打头。 1.2 字符串 在Python中,用引号...
相关热词 c#开发的dll注册 c#的反射 c# grid绑定数据源 c#多线程怎么循环 c# 鼠标左键 c# char占位符 c# 日期比较 c#16进制转换为int c#用递归求顺序表中最大 c#小型erp源代码
立即提问