| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11549 | Easy Palindrome |
|
| 12179 | Queens |
|
| 12661 | The night's watch |
|
| 12678 | Count 1s |
|
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
Long long long long long long long long long long time ago, there's a lovely kingdom named "Chess". There's King, Queen, Knight, Castle, Bishop, ...etc. Just like the modern game "chess".
A king definitely have not only one castle or knight. But no one says that a king shouldn't have two or more queens (same as queen, a queen is able to have two or more kings). Now in this kingdom, the king has N queens.
However, all the queens want to get the title "King's favorite", if one is uglier than the other one (which is judged by the king), then just win by manner. If one is more rude than the other one, then just win by skills. But if a queen loses on everything...... then just let them disappear or die "accidentally"...HEHEHE..... The king soon realized that, for the safety of all of his lovely queens, he must make them cannot see each other.
Now, the king ask you, the mighty programming knight, for a mission. They want to find out how many possibilities that the queens won't launch a war in the palace.
- There are N queens in the palace.
- The palace is just like a chessboard with size N*N.
- Queen can see all people in 8 directions(←, ↑, →, ↓, ↖, ↗, ↘, and ↙. Just like what queen in the chess does). If any queen see other queens, the mission will fail.
- Find out the total amount of states that all queens are placed in the palace and mission isn't fail.
Warning! Do not just look up the answer table! You are supposed to solve this problem by recursive. Otherwise you will regret it!
Input
The input contains exactly one number N.
1 <= N <= 14.
Output
Output only one number ── the total amount of states that queens are placed in the palace and mission isn't failed.
Remember to print a '\n' at the end of the output.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
And now my watch begins.
~by a binge watching man
Your a lord commander of the night's watch. You wants to choose some men to be your soldiers while other lords also needs to choose some men. There're n lords and n soldiers and there're k lords who are your friends therefore they will follow your order. And each soldier's ability is represented by a number ai. Since the lords stand in a line and wait for their turn to choose, you are standing in the m-th position.
Given a sequence of numbers a1 ~ an. n people standing in a line to choose one number from the sequence.
Each person can only choose a number from the head or the tail of the sequence.
Once a number is chosen, it will be remove from the sequence.
You are at m-th position of the line.
You want to get the number as big as possible.
You can command at most k people to choose what you want them to choose(head or tail).
But you can not change your command during the choosing process.
And those who you don't give a command will choose arbitrarily.
Your task is to find out what is the greatest integer x such that, no matter what are the choices of the others you didn't choose to control, the element you will take from the array will be at least x?
Example:
If there are n=6 numbers 2, 9, 2, 3, 8, 5.
You are at m=4 position.
And you can control k=2 people.
If the first person ordered by you choose tail 5.
The second person ordered by you choose head 2.
Then the third person can choose either 9 or 8.
No matter what the third person choose, you can get at least 8.
Therefore the answer is 8.

Input
The first line of input will be t(1 <= t <= 10) means number of testcases.
Each testcases contains two lines.
First line contains three integers n( 1 <= n <= 5000), m(1 <= m <= n), k(0 <= k <= n-1).
Second line contains n integers ai(1 <= ai <= 10^9).
Output
For each testcases, print a single integer x.
Each output is ended by \n.
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.