| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11230 | M Queens N Rocks |
|
| 11549 | Easy Palindrome |
|
| 12142 | Ugandan Knuckles's adventure |
|
| 12678 | Count 1s |
|
Description
The rule for placing a queen or a rock on the board is as follows:
1. Each row and column of the chessboard contains exactly 1 queen , and each diagonal also contains no more than 1 queen.
For example, a queen will threaten any other pieces on the red blocks in the following image

2. Each row and column of the chessboard contains no more than 1 rock.
That is, a rock will threaten any other pieces on the red blocks in the following image

Your have to put M queens and N rocks on an (M+N)x(M+N) chessboard in a way that no one threatens another.
Then, your task is to compute how many possible ways to put M queens and N rocks on the chessboard.
For instance, if M = 7 and N = 1, your answer should be 736 since there are 736 valid ways to arrange 7 queens and 1 rock on the chessboard.
Input
There are 2 integers in a line.
The first integer is M which means the number of queens that you need to put on the chessboard.
The second integer is N which means the number of rocks that you need to put on the chessboard.
Note that 1<=M+N<= 10
Output
An integer which represent the number of possible arrangements of M queens and N rocks.
You have to add '\n' at the end of output!
Sample Input Download
Sample Output Download
Tags
Discuss
Description
The input is a 6-digit floating number N that consists of digits 1-9 except 0. For example, 156.854 is such a number. The task is to reverse the order of the digits of integer part and decimal part respectively to get a new six-digit floating number M, and compute the sum of the N and M. For example, if N is 123.456, then M is 321.654, and the answer should be 445.110.
Hint1: you can use double type to store input
Hint2: if your answer is 445.110000, you can use %.3lf to print 445.110
Input
A six-digit floating number consisting of 1-9 except 0
Output
The sum of the input number and its reversal
The answer should be expressed as a floating point number with precision to the three decimal place. For example, 445.110
Note that you do not need to print ‘\n’ at the end of the output.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
After Knuckles escaped from the dungeon he faced on another difficulty. He meet an elder who claimed that he knew where to find the queen. As long as Knuckles solve the question.
The elder will give Knuckles n integers, and Knuckles can make a big integer by appending those integers after one another.
For example:
If n = 3, Knuckles have three integers: "71", "87", "22". Following integers can be made:
"718722", "227187", "877122", "228771".......
In this example, 6 such integers can be made. Knuckles need to find the biggest integer. In this example, the answer will be "877122".
Help Knuckles find the biggest integer he can make.
Input
The input will end by EOF.
Each input contains several lines.
First line contains an integer n(1 <= n <= 100).
The following n lines, each line contains an interger ai(1 <= ai <=10999)
Each testcase contains at most 10 input.
Output
For each input, print the biggest integer you can make
remember to print \n after each output
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given two number a,b.
You need to calculate how many 1 appear in range a~b(decimal representation).
Example:
Given a = 1, b = 11.
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
There're four 1 appear in range 1~11(1, 10, 11).
The answer is 4.

Input
First line contains one integer t(1 <= t <= 10^6) which means the number of testcases.
The following t lines, each line contains two integer a, b( 1 <= a <= b <= 10^6)
Output
For each testcase print only one number which means the number of 1 appear in range a~b.
Remember to print \n at the end of output.