# | Problem | Pass Rate (passed user / total user) |
---|---|---|
12932 | Drop the ball |
|
12934 | Rotate Numbers |
|
13648 | Text maze |
|
14015 | Hacker Domo |
|
14016 | OSHINOKODA |
|
14018 | Another Hacker Domo |
|
Description
Given a board with N rows and M columns, the rows are numbered from 1 to N from top to bottom, and the columns are numbered from 1 to M from left to right. Each element has one diagonal wall which either runs from top-left corner to bottom-right corner, or runs from top-right corner to bottom-left corner. Now given Q queries, you have to output which column the ball will fall out at the bottom row if you put it on top of the board at specific column. (The ball will naturally fall down due to gravity.)
The following figure is a sample. If you drop the ball at column 2, the ball will fall out at the left side. If you drop the ball at column 5, the ball will be stuck in the board. If you drop the ball at column 3, the ball will eventually fall out at column 2.
Input
First line contains two integers which represent n, m respectively. (1 <= n, m <= 500).
The following N lines which have M characters in each line represent the board. '/' means the wall runs from top-right corner to bottom-left corner, and '\' means the wall runs from top-left corner to bottom-right corner.
Next line contains an integer Q which denotes the number of querys. (1 <= Q <= 100).
Then, the following Q line, each line has one integer which represents the starting column to drop the ball.
Output
For each queries:
If the ball fall out at the right side, you should output "Right!".
If the ball fall out at the left side, you should output "Left!".
If the ball stuck at the board, you should output "Stuck QQ".
Otherwise, you should output "Position: x". x represents which column the ball fall out at the bottom row.
Remember to output '\n' at the end of each line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given a large integer, please rotate the whole number by 180o and print out the result.
For example:
However, sometimes after you rotate the number, it becomes meaningless, for example:
Besides, after you rotate the number, if there are some zeros in the front, do not print them out, for example:
Input
The input contains an integer N, which N is no more than 100 digits.
Output
Output the 180 degree rotated number, if the rotated number is meaningless, output "No". Please add a newline at the end of your answer.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
For Taiwanese people, it is well-known that Taipei station is just like a maze.
Paul is a foreign visitor coming to Taipei for the first time.
To figure out the exact position, he sent a message to his friend, Tommy, for help.
Since the description from Paul is quite confusing, Tommy finds an easier way for Paul to provide the information.
There will be a 2D map composed of alphabets(e.g., a, c, or H), which implies the Taipei station.
First, given the position P (e.g., (2, 3)), he must find the smallest(Using ASCII code) char around him (should be at most eight choices).
Note that if there are duplicated chars, please choose the element with larger index:
Next,
if the chosen char is in ['a', 'f', 'k', 'p', 'E', 'J', 'O', 'T'], please move your current position to the left;
if the chosen char is in ['b', 'g', 'l', 'q', 'D', 'I', 'N', 'S'], please move your current position to the right;
if the chosen char is in ['c', 'h', 'm', 'r', 'C', 'H', 'M', 'R'], please move your current position to the up;
if the chosen char is in ['d', 'i', 'n', 's', 'B', 'G', 'L', 'Q'], please move your current position to the down;
if the chosen char is in ['e', 'j', 'o', 't', 'A', 'F', 'K', 'P'], move your current position into the chosen char, and from now on, you have to find the biggest char, vise versa(If the current mode is to find the biggest char, start to find the smallest one);
if the chosen char isn't in the above choices, please move your current position into the chosen char.
There are two terminal situations:
(1) You reach the edge Your next step is outside the map (Current movement Next movement is illegal).
(2) You reach the given steps.
Once the whole process ends, please print the texts you've visited.
Input
There will be 4 parts for the input:
(1) The size of the map, n. (5 <= n <= 100)
(2) The maximum steps in the process, S. (1 <= S <= n**2 )
(3) The initial position(x, y).It is guaranteed that it is on the map.
(4) The text map with size n*n.
All of them are separated by a '\n'.
Output
The texts you've traversed.
Note that you dont' have to print "\n" at the end.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Domo is a brilliant dog hacker, he wants to find out the password of your computer.
Your password is a sequence of numbers, generated according to the following rules.
Given the number of N and R, we need to arrange the numbers from 1 to N in a continuous Z pattern, where the side length of Z pattern is R.
Here are examples of Z pattern with length 3, 4, and 5. We need to find out which pattern we need to use first.
Next, sequentially fill the numbers from 1 to N into the Z-pattern, starting from the top-left corner.
For example, the Z pattern seems like below when N = 14 and R = 4.
Finally, output each row from top to bottom.
Here's the password when N = 14 and R = 4.
Help Domo find the password, or he'll start getting angry with you.
Input
The first line consists two number N (1 ≤ N ≤ 104) and R (2 ≤ R ≤ 10)
Output
Output the corresponding password sequence, then print a newline character at the end.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Ai is a super idol with the perfect smile.
All of her fans said that there was a star in her eye.
One day, a piece of shocking news claimed that she had become the mother of twins!
To prove this news, an easy way is to find if there is also a star in the baby's eye.
Also, because Ai's children must have the brightest star in their eyes, we need a program to automatically calculate the brightness of a star with a given picture.
Given an image (square matrix) A[N,N], if point P(X,Y) is the center of a star, the brightness is the summation of:
(1) A[X][j], for all 0<=j<N (The values in the Xth row)
(2) A[i][Y], for all 0<=i<N (The values in the Yth column)
(3)
A[X+i][Y+i], for all -N<=i<N if 0<=(X+i)<N and 0<=(Y+i)<N
A[X+i][Y-i], for all -N<=i<N if 0<=(X+i)<N and 0<=(Y-i)<N
(The values of two diagonals from the centers)
Note that when calculating the brightness, the value of the center points is calculated only once.
Please help her fans find the truth, or they may become very angry @@.
Hint.
If you cannot pass all the testcases, you can try to use extra arrays to record some information when you read the input data.
By doing so, you can immediately determine whether a point is a star.
Input
In this problem, with a given image (square matrix), you have to solve T solutions.
There are four parts of the input:
(1) The number of testcases, T. 1<=T<=200000
(2) The size of the square matrix, N. 1<=N<=1024
(3) An N*N matrix separated by a newline character. 0<=The values in the matrices<=N.
(4) T pairs of center points composed of 2 integers, representing the position of the center points.
Output
The brightness of each star in the matrix.
It is guaranteed that the brightness can be represented using unsigned long long datatype.
Note that you need to print "\n" in the end of each answer.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Domo is a brilliant dog hacker, he wants to find out the password of your computer.
This time, he successfully obtained the compressed file containing the password, all he needed to do was unzip it.
The correct format of a password zip must be [integer][alpha][integer][alpha][integer][alpha]......
where [integer] is an integer greater than 0, representing the number of repetitions for the following alphabet.
[alpha] is a letter from the set of [a-z], [A-Z], or ['0', '1', ..., '9']
[integer][alpha] is a basic zip pair unit.
Here are some examples:
Before Unzip | After Unzip |
3a3d4'1' | aaaddd1111 |
2'5'3'7'2c | 55777cc |
5ad3c | Can't Unzip (Wrong format) |
5d3s3 | Can't Unzip (Wrong format) |
5d3s0g | Can't Unzip (integer must > 0) |
Given the zipped string, please help Domo find the correct unzip string (which is the password of the computer). If the string can't be unzipped, output "Domo cannot crack this computer"
Input
The input consists of multiple zipped strings (1 ≤ number of strings ≤ 100), separated by a newline character.
In each string (1 ≤ the length of string ≤ 1000), the [integer] is guaranteed to consist of a number N (0 ≤ N ≤ 100) without any leading zero. There are only uppercase and lowercase letters, digits, and single quotes in the string.
Notice that 0 can appear in the string, but the string can't be unzipped.
Output
Output the corresponding password for every string. It's guaranteed that the length of every unzipped string is less than 1000000.
Remember to print a newline character at the end of every password.