 Lines

Problem Description
You play a game with your friend. He draws several lines on the paper with n×m square grids (see the left figure). After that, he writes down the number of lines passing through every integer coordinate in a matrix (see the right figure).The number of lines passing though coordinate (i,j) is written in cell (i,j) in the right figure.(i,j both start from 0).
You are given the matrix written by your friend. You need to figure out the possible minimal number of lines your friend drew on the paper.
Input
The first line of the input contains an integer T indicating the number of test cases( 0 < T <= 10).For each test case, the first line contains two integers n, m (1 ≤ n, m ≤ 50) representing the size of the grids on the paper. The following (n+1) × (m+1) numbers is what your friend writes. It is guaranteed that the number of lines your friend draws does not exceed 14. Each line passes through integer coordinates at least three times.
Output
For each test case, you need to output the minimal number of lines your friend drew on the paper in a single line.Sample Input
1
5 4
0 1 0 0 1
0 1 0 1 0
2 1 1 0 0
0 3 1 0 0
1 1 1 0 1
0 1 0 1 0Sample Output
4
Matrix Multiplication _course
20170504Let us consider undirected graph G = which has N vertices and M edges. Incidence matrix of this graph is N * M matrix A = {aij}, such that aij is 1 if ith vertex is one of the ends of jth edge and 0 in the other case. Your task is to find the sum of all elements of the matrix ATA. This problem contains multiple test cases! The first line of a multiple input is an integer N, then a blank line followed by N input blocks. Each input block is in the format indicated in the problem description. There is a blank line between input blocks. The output format consists of N output blocks. There is a blank line between output blocks. Input The first line of the input file contains two integer numbers  N and M (2 <= N <= 10 000, 1 <= M <= 100 000). 2M integer numbers follow, forming M pairs, each pair describes one edge of the graph. All edges are different and there are no loops (i.e. edge ends are distinct). Output Output the only number  the sum requested. Sample Input 1 4 4 1 2 1 3 2 3 2 4 Sample Output 18
Magic Square _course
20170327In recreational mathematics, a magic square of ndegree is an arrangement of n2 numbers, distinct integers, in a square, such that the n numbers in all rows, all columns, and both diagonals sum to the same constant. For example, the picture below shows a 3degree magic square using the integers of 1 to 9. Given a finished number square, we need you to judge whether it is a magic square. Input The input contains multiple test cases. The first line of each case stands an only integer N (0 < N < 10), indicating the degree of the number square and then N lines follows, with N positive integers in each line to describe the number square. All the numbers in the input do not exceed 1000. A case with N = 0 denotes the end of input, which should not be processed. Output For each test case, print "Yes" if it's a magic square in a single line, otherwise print "No". Sample Input 2 1 2 3 4 2 4 4 4 4 3 8 1 6 3 5 7 4 9 2 4 16 9 6 3 5 4 15 10 11 14 1 8 2 7 12 13 0 Sample Output No No Yes Yes
Evaluate Matrix Sum _course
20170628Given a matrix, the elements of which are all integer number from 0 to 50, you are required to evaluate the square sum of its specified submatrix. Input The first line of the input contains a single integer T (1 <= T <= 5), the number of test cases. For each test case, the first line contains two integers m and n (1 <= m, n <= 500), which are the row and column sizes of the matrix, respectively. The next m lines with n numbers each gives the elements of the matrix. The next line contains a single integer N (1 <= N <= 100,000), the number of queries. The next N lines give one query on each line, with four integers r1, c1, r2, c2 (1 <= r1 <= r2 <= m, 1 <= c1 <= c2 <= n), which are the indices of the upperleft corner and lowerright corner of the submatrix in question. Output For each test case, first print the number of the test case, then N lines with one number on each line, the required square sum. Refer to the sample output for details. Sample Input 2 2 3 1 2 3 4 5 6 2 1 1 2 2 1 3 2 3 3 3 4 2 3 2 5 1 7 9 2 1 1 1 3 3 Sample Output Case 1: 46 45 Case 2: 193
Rotation Lock Puzzle _course
20170717Problem Description Alice was felling into a cave. She found a strange door with a number square matrix. These numbers can be rotated around the center clockwise or counterclockwise. A fairy came and told her how to solve this puzzle lock: “When the sum of main diagonal and antidiagonal is maximum, the door is open.”. Here, main diagonal is the diagonal runs from the top left corner to the bottom right corner, and antidiagonal runs from the top right to the bottom left corner. The size of square matrix is always odd. This sample is a square matrix with 5*5. The numbers with vertical shadow can be rotated around center ‘3’, the numbers with horizontal shadow is another queue. Alice found that if she rotated vertical shadow number with one step, the sum of two diagonals is maximum value of 72 (the center number is counted only once). Input Multi cases is included in the input file. The first line of each case is the size of matrix n, n is a odd number and 3<=n<=9.There are n lines followed, each line contain n integers. It is end of input when n is 0 . Output For each test case, output the maximum sum of two diagonals and minimum steps to reach this target in one line. Sample Input 5 9 3 2 5 9 7 4 7 5 4 6 9 3 9 3 5 2 8 7 2 9 9 4 1 9 0 Sample Output 72 1
旋转循环矩阵分块的移动，怎么采用C语言的程序编写的思想的途径解决？_course
20190525Problem Description Alice was felling into a cave. She found a strange door with a number square matrix. These numbers can be rotated around the center clockwise or counterclockwise. A fairy came and told her how to solve this puzzle lock: “When the sum of main diagonal and antidiagonal is maximum, the door is open.”. Here, main diagonal is the diagonal runs from the top left corner to the bottom right corner, and antidiagonal runs from the top right to the bottom left corner. The size of square matrix is always odd. This sample is a square matrix with 5*5. The numbers with vertical shadow can be rotated around center ‘3’, the numbers with horizontal shadow is another queue. Alice found that if she rotated vertical shadow number with one step, the sum of two diagonals is maximum value of 72 (the center number is counted only once). Input Multi cases is included in the input file. The first line of each case is the size of matrix n, n is a odd number and 3<=n<=9.There are n lines followed, each line contain n integers. It is end of input when n is 0 . Output For each test case, output the maximum sum of two diagonals and minimum steps to reach this target in one line. Sample Input 5 9 3 2 5 9 7 4 7 5 4 6 9 3 9 3 5 2 8 7 2 9 9 4 1 9 0 Sample Output 72 1
I Speak Whales _course
20170525Problem Description According to Wikipedia, a Walsh matrix is a specific square matrix, with dimensions equal to a power of 2, the entries of which are +1 or 1, and the property that the dot product of any two distinct rows (or columns) is zero. Below are the first three Walsh Matrices. (The gray lines are imaginary lines for illustration purpose only.) A Walsh Matrix of size 2N+1 can be constructed as the ``union" of 4 Walsh Matrices of size 2N arranged such that the lower right matrix is inverted whereas the other 3 matrices are not, i.e.: Let's number the rows of a given Walsh Matrix from the top starting with row 0. Similarly, let's number the columns of the matrix from the left starting with column 0. Given the four integers N , R , S , and E , write a program that will construct a Walsh Matrix of size 2N and will print the sum of all the numbers in row #R between columns #S and #E (inclusive.) Input Your program will be tested on one or more test cases. Each test case is specified using a single line listing four integers in the following order: N , R , S , and E , where 0<=N<=60 , 0<=R < 2^N , 0<=S<=E < 2^N , and ES<=10, 000 . The last line of the input file has four 1's and is not part of the test cases. Output For each test case, print the output on a single line. Sample Input 2 1 0 1 48 0 0 47 1 1 1 1 Sample Output 0 48
I Speak Whales 矩阵问题_course
20191207Problem Description According to Wikipedia, a Walsh matrix is a specific square matrix, with dimensions equal to a power of 2, the entries of which are +1 or 1, and the property that the dot product of any two distinct rows (or columns) is zero. Below are the first three Walsh Matrices. (The gray lines are imaginary lines for illustration purpose only.) A Walsh Matrix of size 2N+1 can be constructed as the ``union" of 4 Walsh Matrices of size 2N arranged such that the lower right matrix is inverted whereas the other 3 matrices are not, i.e.: Let's number the rows of a given Walsh Matrix from the top starting with row 0. Similarly, let's number the columns of the matrix from the left starting with column 0. Given the four integers N , R , S , and E , write a program that will construct a Walsh Matrix of size 2N and will print the sum of all the numbers in row #R between columns #S and #E (inclusive.) Input Your program will be tested on one or more test cases. Each test case is specified using a single line listing four integers in the following order: N , R , S , and E , where 0<=N<=60 , 0<=R < 2^N , 0<=S<=E < 2^N , and ES<=10, 000 . The last line of the input file has four 1's and is not part of the test cases. Output For each test case, print the output on a single line. Sample Input 2 1 0 1 48 0 0 47 1 1 1 1 Sample Output 0 48
矩阵的问题，I Speak Whales_course
20190915Problem Description According to Wikipedia, a Walsh matrix is a specific square matrix, with dimensions equal to a power of 2, the entries of which are +1 or 1, and the property that the dot product of any two distinct rows (or columns) is zero. Below are the first three Walsh Matrices. (The gray lines are imaginary lines for illustration purpose only.) A Walsh Matrix of size 2N+1 can be constructed as the ``union" of 4 Walsh Matrices of size 2N arranged such that the lower right matrix is inverted whereas the other 3 matrices are not, i.e.: Let's number the rows of a given Walsh Matrix from the top starting with row 0. Similarly, let's number the columns of the matrix from the left starting with column 0. Given the four integers N , R , S , and E , write a program that will construct a Walsh Matrix of size 2N and will print the sum of all the numbers in row #R between columns #S and #E (inclusive.) Input Your program will be tested on one or more test cases. Each test case is specified using a single line listing four integers in the following order: N , R , S , and E , where 0<=N<=60 , 0<=R < 2^N , 0<=S<=E < 2^N , and ES<=10, 000 . The last line of the input file has four 1's and is not part of the test cases. Output For each test case, print the output on a single line. Sample Input 2 1 0 1 48 0 0 47 1 1 1 1 Sample Output 0 48
反转对称矩阵的维度，采用C语言计算得到W的值_course
20190214Problem Description According to Wikipedia, a Walsh matrix is a specific square matrix, with dimensions equal to a power of 2, the entries of which are +1 or 1, and the property that the dot product of any two distinct rows (or columns) is zero. Below are the first three Walsh Matrices. (The gray lines are imaginary lines for illustration purpose only.) A Walsh Matrix of size 2N+1 can be constructed as the ``union" of 4 Walsh Matrices of size 2N arranged such that the lower right matrix is inverted whereas the other 3 matrices are not, i.e.: Let's number the rows of a given Walsh Matrix from the top starting with row 0. Similarly, let's number the columns of the matrix from the left starting with column 0. Given the four integers N , R , S , and E , write a program that will construct a Walsh Matrix of size 2N and will print the sum of all the numbers in row #R between columns #S and #E (inclusive.) Input Your program will be tested on one or more test cases. Each test case is specified using a single line listing four integers in the following order: N , R , S , and E , where 0<=N<=60 , 0<=R < 2^N , 0<=S<=E < 2^N , and ES<=10, 000 . The last line of the input file has four 1's and is not part of the test cases. Output For each test case, print the output on a single line. Sample Input 2 1 0 1 48 0 0 47 1 1 1 1 Sample Output 0 48
Moving Object Recognition _course
20171011Description There are many scenarios in which we need to know how fast an object is moving. For example, the airtraffic controller in an airport would like to know the speed of a descending plane and give warning if it's too fast or too slow. The speed detection cameras have helped the police to catch the speeding drivers, and so on. In this problem, you are supposed to write a program to recognize the speed of a moving object. Assume that an object is moving on a two dimensional plane, with a constant speed and direction. A camera is taking a shot every second. Assume the camera can record the real situation of the plain  you don't need to worry about the viewangle. The background is black and the only object is white, except some noise introduced by the camera. Anyway, you can assume that the largest continuous white area is always the object. There is always only one largest continuous white area in this problem. Given several pictures taken by the camera, calculate the speed of the object. Output the speed of the object. A picture is represented by a matrix which contains "." or "x" only, where"." in the matrix means a black block and "x" means a white block. There are at least two pictures. Here are some detailed definitions: The edge of each block is 1 mm (That is, each "." or "x" in the matrix represents one 1mm*1mm block.) "The speed of the object" is defined by the moving speed of the center of the object as geometric center : . Anyway, all the objects are made of square blocks. The geometric center of a single square block is the center of the block. So the geometric center of the object can be calculated as: . Where (X[i],Y[i]) is the coordinates of the ith box's center and N is the number of blocks in the object. A white area is a set of white blocks. A white area is called "continuous white area" if and only if there is always a path connecting two arbitrary blocks in this area. All the blocks in the path are within this area. And each pair of sequential blocks along this path shares a common edge. The average speed is calculated as described in the physics textbook: where t is over all the discrete observation time from 0 to T1. In this problem, we define T as half of the number of observation points. (There are always even number observation points in the test suit.) pos(t) is defined as the observed position of the object's center in time t, that is, calculated from the tth image. The positive direction of X axle is from the left to the right; the positive direction of Y axle is from the top to the bottom. Note that you may get different shape of an object in different pictures. Input The input is a file containing several data cases. Each case begins with a line, with only two numbers: m and k. Then follows by several m*k (m columns, k rows) matrices. Each matrix represents one picture taken by the camera. There are at least two pictures. There is always a separator line between each matrix inside a data set. The separator line is a line with m ""s. The last matrix of a data set is followed by a terminating line  a line with m "="s. A line with two zeros presents the end of the input file. The picture size is at most 256*256. There are at most 256 pictures in one test case. Output For each test case, output a line with two numbers which represent the speed of the object in X and Y direction respectively. The accuracy is up to 2 digits after decimal point. The speeds of the objects are in mm/s. Sample Input 10 5 .........x .....xxx.x ....xxx... .....xxx.. x.........  .........x .........x ...xxx.... ..xxx..... x..xxx.... ========== 0 0 Sample Output 2.00 1.00
Cliff Climbing _course
20170920Problem Description At 17:00, special agent Jack starts to escape from the enemy camp. There is a cliff in between the camp and the nearest safety zone. Jack has to climb the almost vertical cliff by stepping his feet on the blocks that cover the cliff. The cliff has slippery blocks where Jack has to spend time to take each step. He also has to bypass some blocks that are too loose to support his weight. Your mission is to write a program that calculates the minimum time to complete climbing. Figure D1 shows an example of cliff data that you will receive. The cliff is covered with square blocks. Jack starts cliff climbing from the ground under the cliff, by stepping his left or right foot on one of the blocks marked with 'S' at the bottom row. The numbers on the blocks are the "slippery levels". It takes t time units for him to safely put his foot on a block marked with t, where 1 ≤ t ≤ 9. He cannot put his feet on blocks marked with 'X'. He completes the climbing when he puts either of his feet on one of the blocks marked with 'T' at the top row. ![](http://acm.hdu.edu.cn/data/images/23121.png) Figure D1: Example of Cliff Data Jack's movement must meet the following constraints. After putting his left (or right) foot on a block, he can only move his right (or left, respectively) foot. His left foot position (lx, ly) and his right foot position (rx, ry) should satisfy lx < rx and  lx  rx  +  ly  ry  ≤ 3. This implies that, given a position of his left foot in Figure D2 (a), he has to place his right foot on one of the nine blocks marked with blue color. Similarly, given a position of his right foot in Figure D2 (b), he has to place his left foot on one of the nine blocks marked with blue color. ![](http://acm.hdu.edu.cn/data/images/23122.png) Figure D2: Possible Placements of Feet Input The input is a sequence of datasets. The end of the input is indicated by a line containing two zeros separated by a space. Each dataset is formatted as follows: w h s(1,1) ... s(1,w) s(2,1) ... s(2,w) ... s(h,1) ... s(h,w) The integers w and h are the width and the height of the matrix data of the cliff. You may assume 2 ≤ w ≤ 30 and 5 ≤ h ≤ 60. Each of the following h lines consists of w characters delimited by a space. The character s(y, x) represents the state of the block at position (x, y) as follows: * 'S': Jack can start cliff climbing from this block. * 'T': Jack finishes climbing when he reaches this block. * 'X': Jack cannot put his feet on this block. * '1'  '9' (= t): Jack has to spend t time units to put either of his feet on this block. You can assume that it takes no time to put a foot on a block marked with 'S' or 'T'. Output For each dataset, print a line only having a decimal integer indicating the minimum time required for the cliff climbing, when Jack can complete it. Otherwise, print a line only having "1" for the dataset. Each line should not have any characters other than these numbers. Sample Input 6 6 4 4 X X T T 4 7 8 2 X 7 3 X X X 1 8 1 2 X X X 6 1 1 2 4 4 7 S S 2 3 X X 2 10 T 1 1 X 1 X 1 X 1 1 1 X 1 X 1 1 1 X S S 2 10 T X 1 X 1 X 1 X 1 1 1 X 1 X 1 1 1 X S S 10 10 T T T T T T T T T T X 2 X X X X X 3 4 X 9 8 9 X X X 2 9 X 9 7 7 X 7 3 X X 8 9 X 8 9 9 9 6 3 X 5 X 5 8 9 9 9 6 X X 5 X 5 8 6 5 4 6 8 X 5 X 5 8 9 3 9 6 8 X 5 X 5 8 3 9 9 6 X X X 5 X S S S S S S S S S S 10 7 2 3 2 3 2 3 2 3 T T 1 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 4 3 2 3 2 3 2 3 2 3 5 3 2 3 1 3 2 3 2 3 5 2 2 3 2 4 2 3 2 3 5 S S 2 3 2 1 2 3 2 3 0 0 Sample Output 12 5 1 22 12
Moving Object Recognition 运动的对象的识别_course
20191003Description There are many scenarios in which we need to know how fast an object is moving. For example, the airtraffic controller in an airport would like to know the speed of a descending plane and give warning if it's too fast or too slow. The speed detection cameras have helped the police to catch the speeding drivers, and so on. In this problem, you are supposed to write a program to recognize the speed of a moving object. Assume that an object is moving on a two dimensional plane, with a constant speed and direction. A camera is taking a shot every second. Assume the camera can record the real situation of the plain  you don't need to worry about the viewangle. The background is black and the only object is white, except some noise introduced by the camera. Anyway, you can assume that the largest continuous white area is always the object. There is always only one largest continuous white area in this problem. Given several pictures taken by the camera, calculate the speed of the object. Output the speed of the object. A picture is represented by a matrix which contains "." or "x" only, where"." in the matrix means a black block and "x" means a white block. There are at least two pictures. Here are some detailed definitions: The edge of each block is 1 mm (That is, each "." or "x" in the matrix represents one 1mm*1mm block.) "The speed of the object" is defined by the moving speed of the center of the object as geometric center : . Anyway, all the objects are made of square blocks. The geometric center of a single square block is the center of the block. So the geometric center of the object can be calculated as: . Where (X[i],Y[i]) is the coordinates of the ith box's center and N is the number of blocks in the object. A white area is a set of white blocks. A white area is called "continuous white area" if and only if there is always a path connecting two arbitrary blocks in this area. All the blocks in the path are within this area. And each pair of sequential blocks along this path shares a common edge. The average speed is calculated as described in the physics textbook: where t is over all the discrete observation time from 0 to T1. In this problem, we define T as half of the number of observation points. (There are always even number observation points in the test suit.) pos(t) is defined as the observed position of the object's center in time t, that is, calculated from the tth image. The positive direction of X axle is from the left to the right; the positive direction of Y axle is from the top to the bottom. Note that you may get different shape of an object in different pictures. Input The input is a file containing several data cases. Each case begins with a line, with only two numbers: m and k. Then follows by several m*k (m columns, k rows) matrices. Each matrix represents one picture taken by the camera. There are at least two pictures. There is always a separator line between each matrix inside a data set. The separator line is a line with m ""s. The last matrix of a data set is followed by a terminating line  a line with m "="s. A line with two zeros presents the end of the input file. The picture size is at most 256*256. There are at most 256 pictures in one test case. Output For each test case, output a line with two numbers which represent the speed of the object in X and Y direction respectively. The accuracy is up to 2 digits after decimal point. The speeds of the objects are in mm/s. Sample Input 10 5 .........x .....xxx.x ....xxx... .....xxx.. x.........  .........x .........x ...xxx.... ..xxx..... x..xxx.... ========== 0 0 Sample Output 2.00 1.00
Moving Object Recognition 的程序的编写_course
20190914Description There are many scenarios in which we need to know how fast an object is moving. For example, the airtraffic controller in an airport would like to know the speed of a descending plane and give warning if it's too fast or too slow. The speed detection cameras have helped the police to catch the speeding drivers, and so on. In this problem, you are supposed to write a program to recognize the speed of a moving object. Assume that an object is moving on a two dimensional plane, with a constant speed and direction. A camera is taking a shot every second. Assume the camera can record the real situation of the plain  you don't need to worry about the viewangle. The background is black and the only object is white, except some noise introduced by the camera. Anyway, you can assume that the largest continuous white area is always the object. There is always only one largest continuous white area in this problem. Given several pictures taken by the camera, calculate the speed of the object. Output the speed of the object. A picture is represented by a matrix which contains "." or "x" only, where"." in the matrix means a black block and "x" means a white block. There are at least two pictures. Here are some detailed definitions: The edge of each block is 1 mm (That is, each "." or "x" in the matrix represents one 1mm*1mm block.) "The speed of the object" is defined by the moving speed of the center of the object as geometric center : . Anyway, all the objects are made of square blocks. The geometric center of a single square block is the center of the block. So the geometric center of the object can be calculated as: . Where (X[i],Y[i]) is the coordinates of the ith box's center and N is the number of blocks in the object. A white area is a set of white blocks. A white area is called "continuous white area" if and only if there is always a path connecting two arbitrary blocks in this area. All the blocks in the path are within this area. And each pair of sequential blocks along this path shares a common edge. The average speed is calculated as described in the physics textbook: where t is over all the discrete observation time from 0 to T1. In this problem, we define T as half of the number of observation points. (There are always even number observation points in the test suit.) pos(t) is defined as the observed position of the object's center in time t, that is, calculated from the tth image. The positive direction of X axle is from the left to the right; the positive direction of Y axle is from the top to the bottom. Note that you may get different shape of an object in different pictures. Input The input is a file containing several data cases. Each case begins with a line, with only two numbers: m and k. Then follows by several m*k (m columns, k rows) matrices. Each matrix represents one picture taken by the camera. There are at least two pictures. There is always a separator line between each matrix inside a data set. The separator line is a line with m ""s. The last matrix of a data set is followed by a terminating line  a line with m "="s. A line with two zeros presents the end of the input file. The picture size is at most 256*256. There are at most 256 pictures in one test case. Output For each test case, output a line with two numbers which represent the speed of the object in X and Y direction respectively. The accuracy is up to 2 digits after decimal point. The speeds of the objects are in mm/s. Sample Input 10 5 .........x .....xxx.x ....xxx... .....xxx.. x.........  .........x .........x ...xxx.... ..xxx..... x..xxx.... ========== 0 0 Sample Output 2.00 1.00
Moving Object Recognition 关于运动物的实现_course
20200610Description There are many scenarios in which we need to know how fast an object is moving. For example, the airtraffic controller in an airport would like to know the speed of a descending plane and give warning if it's too fast or too slow. The speed detection cameras have helped the police to catch the speeding drivers, and so on. In this problem, you are supposed to write a program to recognize the speed of a moving object. Assume that an object is moving on a two dimensional plane, with a constant speed and direction. A camera is taking a shot every second. Assume the camera can record the real situation of the plain  you don't need to worry about the viewangle. The background is black and the only object is white, except some noise introduced by the camera. Anyway, you can assume that the largest continuous white area is always the object. There is always only one largest continuous white area in this problem. Given several pictures taken by the camera, calculate the speed of the object. Output the speed of the object. A picture is represented by a matrix which contains "." or "x" only, where"." in the matrix means a black block and "x" means a white block. There are at least two pictures. Here are some detailed definitions: The edge of each block is 1 mm (That is, each "." or "x" in the matrix represents one 1mm*1mm block.) "The speed of the object" is defined by the moving speed of the center of the object as geometric center : . Anyway, all the objects are made of square blocks. The geometric center of a single square block is the center of the block. So the geometric center of the object can be calculated as: . Where (X[i],Y[i]) is the coordinates of the ith box's center and N is the number of blocks in the object. A white area is a set of white blocks. A white area is called "continuous white area" if and only if there is always a path connecting two arbitrary blocks in this area. All the blocks in the path are within this area. And each pair of sequential blocks along this path shares a common edge. The average speed is calculated as described in the physics textbook: where t is over all the discrete observation time from 0 to T1. In this problem, we define T as half of the number of observation points. (There are always even number observation points in the test suit.) pos(t) is defined as the observed position of the object's center in time t, that is, calculated from the tth image. The positive direction of X axle is from the left to the right; the positive direction of Y axle is from the top to the bottom. Note that you may get different shape of an object in different pictures. Input The input is a file containing several data cases. Each case begins with a line, with only two numbers: m and k. Then follows by several m*k (m columns, k rows) matrices. Each matrix represents one picture taken by the camera. There are at least two pictures. There is always a separator line between each matrix inside a data set. The separator line is a line with m ""s. The last matrix of a data set is followed by a terminating line  a line with m "="s. A line with two zeros presents the end of the input file. The picture size is at most 256*256. There are at most 256 pictures in one test case. Output For each test case, output a line with two numbers which represent the speed of the object in X and Y direction respectively. The accuracy is up to 2 digits after decimal point. The speeds of the objects are in mm/s. Sample Input 10 5 .........x .....xxx.x ....xxx... .....xxx.. x.........  .........x .........x ...xxx.... ..xxx..... x..xxx.... ========== 0 0 Sample Output 2.00 1.00
Fast Image Match _course
20170510Given two images A and B, use image B to cover image A. Where would we put B on A, so that the overlapping part of A and B has the most likelihood? To simplify the problem, we assume that A and B only contain numbers between 0 and 255. The difference between A and B is defined as the square sum of the differences of corresponding elements in the overlapped parts of A and B. For example, we have A (3 * 3): a1 a2 a3 B (2 * 2): b1 b2 a4 a5 a6 b4 b5 a7 a8 a9 When B is placed on position a5, the difference of them is ((b1a5)^2 + (b2a6)^2 + (b4a8)^2 + (b5a9)^2). Now we hope to have the position of the top left corner of B that gives the minimum difference. (B must completely reside on A) It is clear that a simple solution will appear with very low efficiency when A and B have too many elements. But we can use 1dimensional repeat convolution, which can be computed by Fast Fourier Transform (FFT), to improve the performance. A program with explanation of FFT is given below: /** * Given two sequences {a1, a2, a3.. an} and {b1, b2, b3... bn}, * their repeat convolution means: * r1 = a1*b1 + a2*b2 + a3*b3 + ... + an*bn * r2 = a1*bn + a2*b1 + a3*b2 + ... + an*bn1 * r3 = a1*bn1 + a2*bn + a3*b1 + ... + an*bn2 * ... * rn = a1*b2 + a2*b3 + a3*b4 + ... + an1*bn + an*b1 * Notice n >= 2 and n must be power of 2. */ #include <vector> #include <complex> #include <cmath> #define for if (0); else for using namespace std; const int MaxFastBits = 16; int **gFFTBitTable = 0; int NumberOfBitsNeeded(int PowerOfTwo) { for (int i = 0;; ++i) { if (PowerOfTwo & (1 << i)) { return i; } } } int ReverseBits(int index, int NumBits) { int ret = 0; for (int i = 0; i < NumBits; ++i, index >>= 1) { ret = (ret << 1)  (index & 1); } return ret; } void InitFFT() { gFFTBitTable = new int *[MaxFastBits]; for (int i = 1, length = 2; i <= MaxFastBits; ++i, length <<= 1) { gFFTBitTable[i  1] = new int[length]; for (int j = 0; j < length; ++j) { gFFTBitTable[i  1][j] = ReverseBits(j, i); } } } inline int FastReverseBits(int i, int NumBits) { return NumBits <= MaxFastBits ? gFFTBitTable[NumBits  1][i] : ReverseBits(i, NumBits); } void FFT(bool InverseTransform, vector<complex<double> >& In, vector<complex<double> >& Out) { if (!gFFTBitTable) { InitFFT(); } // simultaneous data copy and bitreversal ordering into outputs int NumSamples = In.size(); int NumBits = NumberOfBitsNeeded(NumSamples); for (int i = 0; i < NumSamples; ++i) { Out[FastReverseBits(i, NumBits)] = In[i]; } // the FFT process double angle_numerator = acos(1.) * (InverseTransform ? 2 : 2); for (int BlockEnd = 1, BlockSize = 2; BlockSize <= NumSamples; BlockSize <<= 1) { double delta_angle = angle_numerator / BlockSize; double sin1 = sin(delta_angle); double cos1 = cos(delta_angle); double sin2 = sin(delta_angle * 2); double cos2 = cos(delta_angle * 2); for (int i = 0; i < NumSamples; i += BlockSize) { complex<double> a1(cos1, sin1), a2(cos2, sin2); for (int j = i, n = 0; n < BlockEnd; ++j, ++n) { complex<double> a0(2 * cos1 * a1.real()  a2.real(), 2 * cos1 * a1.imag()  a2.imag()); a2 = a1; a1 = a0; complex<double> a = a0 * Out[j + BlockEnd]; Out[j + BlockEnd] = Out[j]  a; Out[j] += a; } } BlockEnd = BlockSize; } // normalize if inverse transform if (InverseTransform) { for (int i = 0; i < NumSamples; ++i) { Out[i] /= NumSamples; } } } vector<double> convolution(vector<double> a, vector<double> b) { int n = a.size(); vector<complex<double> > s(n), d1(n), d2(n), y(n); for (int i = 0; i < n; ++i) { s[i] = complex<double>(a[i], 0); } FFT(false, s, d1); s[0] = complex<double>(b[0], 0); for (int i = 1; i < n; ++i) { s[i] = complex<double>(b[n  i], 0); } FFT(false, s, d2); for (int i = 0; i < n; ++i) { y[i] = d1[i] * d2[i]; } FFT(true, y, s); vector<double> ret(n); for (int i = 0; i < n; ++i) { ret[i] = s[i].real(); } return ret; } int main() { double a[4] = {1, 2, 3, 4}, b[4] = {1, 2, 3, 4}; vector<double> r = convolution(vector<double>(a, a + 4), vector<double>(b, b + 4)); // r[0] = 30 (1*1 + 2*2 + 3*3 + 4*4) // r[1] = 24 (1*4 + 2*1 + 3*2 + 4*3) // r[2] = 22 (1*3 + 2*4 + 3*1 + 4*2) // r[3] = 24 (1*2 + 2*3 + 3*4 + 4*1) return 0; } Input The first line contains n (1 <= n <= 10), the number of test cases. For each test case, the first line contains four integers m, n, p and q, where A is a matrix of m * n, B is a matrix of p * q (2 <= m, n, p, q <= 500, m >= p, n >= q). The following m lines are the elements of A and p lines are the elements of B. Output For each case, print the position that gives the minimum difference (the top left corner of A is (1, 1)). You can assume that each test case has a unique solution. Sample Input 2 2 2 2 2 1 2 3 4 2 3 1 4 3 3 2 2 0 5 5 0 5 5 0 0 0 5 5 5 5 Sample Output 1 1 1 2
 24.46MB
图书管理系统（Java + Mysql）我的第一个完全自己做的实训项目
20190104图书管理系统 Java + MySQL 完整实训代码，MVC三层架构组织，包含所有用到的图片资源以及数据库文件，大三上学期实训，注释很详细，按照阿里巴巴Java编程规范编写
专为程序员设计的数学课_course
20191111<p> 限时福利限时福利，<span>15000+程序员的选择！</span> </p> <p> 购课后添加学习助手（微信号：csdn590），按提示消息领取编程大礼包！并获取讲师答疑服务！ </p> <p> <br> </p> <p> 套餐中一共包含5门程序员必学的数学课程（共47讲） </p> <p> 课程1：《零基础入门微积分》 </p> <p> 课程2：《数理统计与概率论》 </p> <p> 课程3：《代码学习线性代数》 </p> <p> 课程4：《数据处理的最优化》 </p> <p> 课程5：《马尔可夫随机过程》 </p> <p> <br> </p> <p> 哪些人适合学习这门课程？ </p> <p> 1）大学生，平时只学习了数学理论，并未接触如何应用数学解决编程问题； </p> <p> 2）对算法、数据结构掌握程度薄弱的人，数学可以让你更好的理解算法、数据结构原理及应用； </p> <p> 3）看不懂大牛代码设计思想的人，因为所有的程序设计底层逻辑都是数学； </p> <p> 4）想学习新技术，如：人工智能、机器学习、深度学习等，这门课程是你的必修课程； </p> <p> 5）想修炼更好的编程内功，在遇到问题时可以灵活的应用数学思维解决问题。 </p> <p> <br> </p> <p> 在这门「专为程序员设计的数学课」系列课中，我们保证你能收获到这些:<br> <br> <span> </span> </p> <p class="qllong24357476"> <span class="qlauthor24357476">①价值300元编程课程大礼包</span> </p> <p class="qllong24357476"> <span class="qlauthor24357476">②应用数学优化代码的实操方法</span> </p> <p class="qllong24357476"> <span class="qlauthor24357476">③数学理论在编程实战中的应用</span> </p> <p class="qllong24357476"> <span class="qlauthor24357476">④程序员必学的5大数学知识</span> </p> <p class="qllong24357476"> <span class="qlauthor24357476">⑤人工智能领域必修数学课</span> </p> <p> <br> 备注：此课程只讲程序员所需要的数学，即使你数学基础薄弱，也能听懂，只需要初中的数学知识就足矣。<br> <br> 如何听课？ </p> <p> 1、登录CSDN学院 APP 在我的课程中进行学习； </p> <p> 2、登录CSDN学院官网。 </p> <p> <br> </p> <p> 购课后如何领取免费赠送的编程大礼包和加入答疑群？ </p> <p> 购课后，添加助教微信：<span> csdn590</span>，按提示领取编程大礼包，或观看付费视频的第一节内容扫码进群答疑交流！ </p> <p> <img src="https://imgbss.csdn.net/201912251155398753.jpg" alt=""> </p>
快速入门Android开发 视频 教程 android studio
20190327这是一门快速入门Android开发课程，顾名思义是让大家能快速入门Android开发。 学完能让你学会如下知识点: Android的发展历程 搭建Java开发环境 搭建Android开发环境 Android Studio基础使用方法 Android Studio创建项目 项目运行到模拟器 项目运行到真实手机 Android中常用控件 排查开发中的错误 Android中请求网络 常用Android开发命令 快速入门Gradle构建系统 项目实战：看美图 常用Android Studio使用技巧 项目签名打包 如何上架市场
 3KB
谷粒商城2020.5月最新升级全套版基础+高级+高可用集群
20200716谷粒商城2020.5月最新升级全套版基础+高级+高可用集群，已完结！
程序员的MySQL学习宝典_course
20200622<p> 程序员的必经之路！ </p> <p> 【限时优惠】 </p> <p> <br> </p> <p> 现在下单，还享四重好礼：<br> 1、教学课件免费下载<br> 2、课程案例代码免费下载<br> 3、专属VIP学员群免费答疑<br> 4、下单还送800元编程大礼包 </p> <p> <br> </p> <p> 【超实用课程内容】 </p> <p> 根据《20192020年中国开发者调查报告》显示，超83%的开发者都在使用MySQL数据库。使用量大同时，掌握MySQL早已是运维、DBA的必备技能，甚至部分IT开发岗位也要求对数据库使用和原理有深入的了解和掌握。 学习编程，你可能会犹豫选择 C++ 还是 Java；入门数据科学，你可能会纠结于选择 Python 还是 R；但无论如何， MySQL 都是 IT 从业人员不可或缺的技能！ </p> <p> <br> </p> <p> 套餐中一共包含2门MySQL数据库必学的核心课程（共98课时） </p> <p> 课程1：《MySQL数据库从入门到实战应用》 </p> <p> 课程2：《高性能MySQL实战课》 </p> <p> <br> </p> <p> 【哪些人适合学习这门课程？】 </p> <p> 1）平时只接触了语言基础，并未学习任何数据库知识的人； </p> <p> 2）对MySQL掌握程度薄弱的人，课程可以让你更好发挥MySQL最佳性能； </p> <p> 3）想修炼更好的MySQL内功，工作中遇到高并发场景可以游刃有余； </p> <p> 4）被面试官打破沙锅问到底的问题问到怀疑人生的应聘者。 </p> <p> <br> </p> <p> 【课程主要讲哪些内容？】 </p> <p> 课程一：<span>《MySQL数据库从入门到实战应用》 主要从基础篇，SQL语言篇、MySQL进阶篇三个角度展开讲解，帮助大家更加高效的管理MySQL数据库。</span> </p> <p> <br> </p> <p> <img src="https://imgbss.csdnimg.cn/202006261532354009.png" alt=""> </p> <p> <br> </p> <p> 课程二：《高性能MySQL实战课》主要从高可用篇、MySQL8.0新特性篇，性能优化篇，面试篇四个角度展开讲解，帮助大家<span>发挥MySQL的最佳性能的优化方法，<span>掌握如何处理海量业务数据和高并发请求</span></span> </p> <p> <br> </p> <p> <img src="https://imgbss.csdnimg.cn/202006261533103261.png" alt=""> </p> <p> <br> </p> <p> 【你能收获到什么？】 </p> <p> 1.基础再提高，针对MySQL核心知识点学透，用对； </p> <p> 2.能力再提高，日常工作中的代码换新貌，不怕问题； </p> <p> 3.面试再加分，巴不得面试官打破沙锅问到底，竞争力MAX。 </p> <p> <br> </p> <p> 【课程如何观看？】 </p> <p> 1、登录CSDN学院 APP 在我的课程中进行学习； </p> <p> 2、移动端：CSDN 学院APP（注意不是CSDN APP哦） </p> <p> 本课程为录播课，课程永久有效观看时长 【资料开放】 课件、课程案例代码完全开放给你，你可以根据所学知识，自行修改、优化。 </p> <p> 下载方式：电脑登录课程观看页面，点击右侧课件，可进行课程资料的打包下载。 </p>
 111.65MB
DirectX修复工具V4.0增强版
20200613DirectX修复工具(DirectX Repair)是一款系统级工具软件，简便易用。本程序为绿色版，无需安装，可直接运行。 本程序的主要功能是检测当前系统的DirectX状态，如果发现异常则进行修复
实用数据分析：数据分析师从小白到精通
20200102以实用为第一标准的数据分析方法，详细讲解了数据分析的分析方法、使用场景、分析原理和实战案例，帮助学习者系统打造从数据中获取信息的能力。
 75.76MB
华为海思数字IC提前批笔试题目，2020届华为海思校园招聘，西南地区
20190827华为海思数字IC提前批笔试题目，2020届华为海思校园招聘，西南地区。单选和多选题华为海思数字IC提前批笔试题目，2020届华为海思校园招聘，西南地区。单选和多选题
 1.21MB
2020年五一赛B题论文
20200523自己做的五一赛论文，代码数据都在附录。本文针对股票投资组合问题进行了研究，建立了投资效用与多目标规划模 型，运用了历史模拟、灰色关联等方法，旨在确定股票投资组合策略。
 157KB
图的着色问题(相邻边的颜色不同)
20110719图的着色问题是由地图的着色问题引申而来的：用m种颜色为地图着色，使得地图上的每一个区域着一种颜色，且相邻区域颜色不同。
Python入门到实战一卡通_course
20200609<br> <span><span><span><span> <p class="qllong24357476"> <span> </span> </p> <p class="qllong24357476"> 【课程特色】 </p> <p class="qllong24357476"> <span class="qlauthor24357476">1、超强师资+体系全面+ 1 对 1 答疑+离线缓存+永久有效，无限回放</span> </p> <p class="qllong24357476"> 2、知识全面系统，从Python入门到逐步进阶到爬虫、数据分析、Web框架、人工智能应用 </p> <p class="qllong24357476"> 【优惠说明】 </p> <p class="qllong24357476"> <span class="qlauthor24357476">1、8大课程，240余节视频课，原价998元，今日联报立减800，仅需198元</span> </p> <p class="qllong24357476"> <span class="qlauthor24357476">2、</span>现在购课，就送价值800元的编程大礼包！ </p> <p class="qllong24357476"> 备注：请添加微信，按提示获取讲师答疑服务。<img src="https://imgbss.csdnimg.cn/202008050606042509.jpg" alt=""> </p> <p> <br> </p> <p class="qllong24357476"> 讲师介绍：裴帅帅，前百度资深架构师，现爱奇艺算法架构师全程亲自授课。 </p> <p> <br> </p> <p class="qllong24357476"> 【为什么要学习这门套餐课？】 </p> <p class="qllong24357476"> Python无论是在web/爬虫/人工智能/大数据/机器学习/测试/运维/数据分析等等领域都有大量的应用，但是作为小白来讲，很难确定最适合自己的应用方向。 </p> <p> <br> </p> <p class="qllong24357476"> 在这门课程中，将带你从零入门Python，并向你讲授实战 Python 各个应用方向的核心知识点，同时应用于实战项目。 </p> <p> <br> </p> <p class="qllong24357476"> 【学完后我将达到什么水平？】 </p> <p class="qllong24357476"> 你将能够熟练掌握 Python 在人工智能时代的多种技能，具备使用 Python 编写代码完成 Web 后台开发、网络爬虫、数据分析、机器学习、推荐系统等多种项目实战的能力，掌握 Python 全栈工程师的核心能力。 </p> <p> <br> </p> <p class="qllong24357476"> 【课程学习路径】 </p> <p class="qllong24357476"> 本套课以市场就业和职位需求为核心，从 Python 入门到多领域实战，并结合 Python 全栈工程师的进阶路线，共分为八大模块，分别是：Python 基础、Python Web 开发、Python 爬虫、Numpy 数据计算、Pandas 数据分析、Python数据可视化、Tensorflow 深度学习、推荐系统实战应用模块。 </p> <p> <br> </p> <p class="qllong24357476"> 套餐中一共包含8门Python课程（共246讲）助你从零进阶Python全栈工程师！ </p> <p class="qllong24357476"> 课程1：《Python零基础入门视频教程》 </p> <p class="qllong24357476"> 课程2：《Python爬虫从入门到实战》 </p> <p class="qllong24357476"> 课程3：《Python使用Flask开发Web服务》 </p> <p class="qllong24357476"> 课程4：《Python使用Numpy入门数据计算》 </p> <p class="qllong24357476"> 课程5：《Python使用Pandas入门数据分析》 </p> <p class="qllong24357476"> 课程6：《Python数据图表可视化》 </p> <p class="qllong24357476"> 课程7：《Tensorflow深度学习从入门到实战》 </p> <p class="qllong24357476"> 课程8：《推荐系统技术入门到实战》 </p> <p> <br> </p> <p class="qllong24357476"> 【面向人群】 </p> <p class="qllong24357476"> 1、在校计算机专业或者对软件编程感兴趣的学生； </p> <p class="qllong24357476"> 2、想要使用数据分析、网络爬虫提升职场竞争力升职加薪的各行各业的企业白领； </p> <p class="qllong24357476"> 3、想要转方向成为数据分析师、大数据开发、机器学习算法、推荐系统工程师的职场码农； </p> <p class="qllong24357476"> 4、准备从事人工智能、Python开发的程序员。 </p> </span> <p> <br> </p> <p class="qllong24357476"> <br> </p> <p> <br> </p> <p class="qllong24357476"> 【课程知识体系图】 </p> </span></span></span> <p> <img src="https://imgbss.csdnimg.cn/202006100818561687.png" alt=""> </p>
软件测试2小时入门
20181010本课程内容系统、全面、简洁、通俗易懂，通过2个多小时的介绍，让大家对软件测试有个系统的理解和认识，具备基本的软件测试理论基础。 主要内容分为5个部分： 1 软件测试概述，了解测试是什么、测试的对象、原则、流程、方法、模型； 2.常用的黑盒测试用例设计方法及示例演示； 3 常用白盒测试用例设计方法及示例演示； 4.自动化测试优缺点、使用范围及示例‘； 5.测试经验谈。
 博客 2020.8.6总结
 博客 安卓应用架构
 学院 2020年 Kubernetes架构师：k8s从零开始的进阶之路
 下载 反应红LS7B(C.I.反应红250) GB/T 337862017
 学院 信息系统项目管理师通关教程1阶段10大知识领域+2章基础知识
 学院 Python自动化爬虫实战与高级架构技巧
 下载 从多路器代码中的小感触
 下载 喷锡常见问题与解决方法
 博客 小肚子下不去？——互联网人减脂指南
 学院 信息系统项目管理师通关教程第3阶段选择题2016上
 博客 Java高并发之设计模式，设计思想
 下载 粘贴板小工具PasteHelperV1.0
 学院 Spark+AI深度学习动手实践
 博客 队列做题：1333：Blah数集（单调队列）
 下载 基于pynq的简易HDMI服务器
 博客 趣拿的派样引流有何优势？
 学院 WPF基础课程二合一
 学院 企业十大应用zabbix运维监控
 博客 力扣 83. 删除排序链表中的重复元素 链表+模拟
 博客 git 使用小结
 博客 WEB和HTTP的基础
 下载 多模态语音情感语料库的 语言符号学“全文本”解读.pdf
 学院 【SpringBoot项目实战】超市销售管理系统
 博客 JVM类加载器，类加载机制详解，看这一篇就够了
 下载 ILSpy反编译工具.zip
 下载 settings.zip
 学院 基于springcloud+Vue整合前后端分离权限管理系统 第二季
 博客 马拉车算法
 学院 Kubernetes中间件容器化
 下载 TikTok 日本版.zip