A00001. Arrangement of pointers
topic description
Xiao Ming bought a batch of authentic small pointers from Taobao. There are m rows and n columns. ,N,X,B,DN,DB,XN,XB), if you don’t turn to another direction at one time, it will return to the original state. Due to the merchant’s irresponsibility, the direction of the pointer is different, so Xiao Ming Wants to turn the needle in one direction, but he wants to know the minimum time he needs to spend. So, it took him 0.5 seconds to hold and place the pointer, and he told you the direction of all the pointers and the speed R at which he turned the pointer. Come and help him do the math
input format
The first line is an integer m, n, separated by a space
The second line is an integer R, indicating that it takes one second to rotate R degrees
Line 3-line m+2, each line has n character data, separated by spaces (the number of spaces is not necessarily)
output format
A line with 4 decimal places indicates the required time. (unit: second)
5 5
90
D D D D D
D D D D D
B B B B B
DN DN DN DN DN
D D D D D
12.5000
Example Explanation 1
The pointer I bought has 5 rows and 5 rows, and it turns 90 degrees per second
After judgment, it should turn to the D direction, so the pointer in the B direction needs to be turned 90 degrees, and the pointer in the DN direction needs to be turned 45 degrees
It takes 675/90=7.5 seconds for the ten pointers to turn (90+45) × 5=675 degrees, and 10 × 0.5=5 seconds for holding and placing the pointers, and 7.5+5=12.5 seconds in total
Data Size and Conventions
m<=5000;n<=5000
R<=2000 (sometimes he will find many good helpers)
A00002. Black and white iteration
topic description
1. Game rules
On the m*n blank board, every time you click a square, the color of the square and the surrounding squares will be reversed. You need to memorize the target figure and build it perfectly on the blank board.
In fact, the black-and-white iteration is very similar to a classic game— the light-on game (also known as the light-off/light-off game or the flip game), just swap the initial state and the target state of the two (the initial state of the black-and-white iteration is all white, Target designation graphics; and lighting game is the initial designation graphics, all the targets are lit.) The process and rules are exactly the same. The rules of the lighting game: In an m×n square, there are several lights on. Click on any light (it can be clicked regardless of whether the light is on or off), then the light and the five adjacent lights up, down, left, and right will become opposite to itself at the same time The state of the light, that is, the light turns off, and the light turns bright. How to turn on all the lights?
input format
The first line is m and n, separated by spaces
Lines 2 to n+1, m data per line. Indicates the target graphic
output format
One line, one coordinate, that is, the grid to be operated. (Output from left to right, top to bottom, try to make the least number of operation squares)
5 5
0 0 0 0 0
0 0 1 0 0
0 1 1 1 0
0 0 1 0 0
0 0 0 0 0
3 3
Data Size and Conventions
For 100 % 100\%100% of the data,1 ≤ n ≤ 2 × 1 0 3 1\le n\le 2\times 10^31≤n≤2×103,1 ≤m ≤ 2 × 1 0 3 1\le m\le 2\times 10^31≤m≤2×103。。
A00003. Kance reasoning
topic description
1. Game rules
There is an m*n disk, the number of targets in each row and column is given, the black grid does not contain targets, find all targets, output all answers and the total number of answers (first output the answer with the target on the left)
input format
The first line is m and n, separated by spaces
Line 2, m data. Represents the target graph for each column
Line 3, n data. represents the target graph for each row
output format
The first line of output is the total number of solutions s.
Followed by s square matrix, X means the target position, 0 means no target, separated by spaces
2 2
1 1
1 1
0 0
0 0
2
X 0
0 X
0 X
X 0
input data 2
3 3
1 1 1
1 1 1
0 0 0
0 1 0
0 0 0
output data 2
4
X 0 0
0 0 X
0 X 0
0 X 0
X 0 0
0 0 X
0 X 0
0 0 X
X 0 0
0 0 X
X 0 0
0 X 0
Data Size and Conventions
For 100 % 100\%100% of the data,1 ≤ n ≤ 2 × 1 0 3 1\le n\le 2\times 10^31≤n≤2×103,1 ≤m ≤ 2 × 1 0 3 1\le m\le 2\times 10^31≤m≤2×103。。
A00004. Liugong number bureau
topic description
1. Game rules
On a hexagonal disk with side length n, there are many numbers, you need to analyze the prime factors of each number, from the bottom grid to the top grid
input format
The first line is n,
Lines 2 to n, with m data in each line. Indicates the target graphic (flipped by 90 degrees)
output format
A row of 2 numbers, that is, the square to move to. (Minimize the passed numbers, if they are the same, output the sum of the passed numbers)
5
308 454 219 304 248
271 416 473 291 361 392
286 330 875 175 367 472 266
434 432 164 621 316 269 450 484
54 332 103 328 300 494 391 115 413
244 376 370 131 356 426 495 74
215 409 235 457 401 346 290
625 317 459 321 513 265
427 112 172 364 131
54->244
244->625
625->513
513->300
300->308
308->875
875->472
472->74
74->413
Data Size and Conventions
For 100 % 100\%100% of the data,1 ≤ n ≤ 2 × 1 0 3 1\le n\le 2\times 10^31≤n≤2×103,
A00005 Star shifting
topic description
1. Game rules
There is an m*n disk, the target figure and the existing figure are given, and the existing figure is transformed into the target figure. When moving, all the figures in the row or column are moved by one grid, and the last figure is automatically added to the first one.
input format
The first line is m and n, separated by spaces
From line 2 to line n+1, each line contains m data. an existing graph representing each column
From line n+2 to line 2n+1, each line contains m data. Represents the target graph for each column
output format
Multiple rows, indicating the rows and columns that need to be operated
("<" means to move a line to the left, ">" means to move a line to the right,
"+" means turn a column up, "-" means turn a column down,
By default, the row is operated first, and then the column is operated.
Operate the row above first, and operate the column on the left first.
The total number of operations should be minimal)
2 2
1 2
1 2
2 1
2 1
1>
2>
input data 2
3 3
0 0 0
0 0 0
0 1 1
1 1 0
0 0 0
0 0 0
output data 2
3<
1-
2-
Data Size and Conventions
For 100 % 100\%100% of the data,1 ≤ n ≤ 2 × 1 0 3 1\le n\le 2\times 10^31≤n≤2×103,1 ≤m ≤ 2 × 1 0 3 1\le m\le 2\times 10^31≤m≤2×103。。
#include <iostream>
using namespace std;
int main()
{
cout<<"代码可以发评论区";
return 0;
}