| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11549 | Easy Palindrome |
|
| 12125 | Tired janitor |
|
| 12133 | Yes papa |
|
| 12733 | Salary thief |
|
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
There were n rows of seats in the classroom. Each row of seats littered with ai unit of trash.
For example: first row contained a1 unit of trash
The janitor wanted to know how many units of trash were littered among row l to row r?
For example: If janitor ask you about row l = 3 to row r = 6. You should answer a3 + a4 + a5 + a6 unit of trash.
There will be q queries, help janitor find out the answer so janitor can clean up the class room.
Note that because janitor is furious about picking up trash, each number will be follow by a symbol " (/`A`)/ ~I__I " without quotation mark and then there is a blank to separate from the next number.
Note that if you use a loop to get the sum of al ~ ar at each query you will get an Time limit exceed.
You can use prefix sum to solve this problem
Input
input contains several lines.
First line contains two integer n(1 <= n <= 106), q(1 <= q <= 105) -- the number of rows and the number of queries.
Second line contains n integer a1 ~ an (0 <= ai <= 109), and each interger followed by a symbol " (/`A`)/ ~I__I " and then there is a blank to separate from the next number.
The following q lines each lines contains two integers l, r ( 1 <= l <= r <= n )
Output
output contain q lines, to each query output the sum of al ~ ar. remember to print \n at the end of each line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Johnny is a three years old kid. He likes to eat sugar. One day, he sneaked into the kitchen in order to grab some sugar to eat. Unfortunately, his papa catched him.
His papa called him: " Johnny, Johnny! "
Johnny replied: " Yes, papa. "
papa then asked: " Eating sugar? "
Johnny lied: " No, papa. "
At that moment, Johnny began to think that what's defintion of string equivalent?
Johnny thinks that string a and string b is equivalent if a and b are the same or string a and string b can be devided into two same size part: a1, a2, b1, b2 and the following rules fulfill:
( ( a1 == b1 ) && ( a2 == b2 ) ) or ( ( a1 == b2 ) && ( a2 == b1 ) )
In above sentence, "==" means whether a and b are the same or string a and string b can be devided into two same size part: a1, a2, b1, b2 and the following rules fulfill: ( ( a1 == b1 ) && ( a2 == b2 ) ) or ( ( a1 == b2 ) && ( a2 == b1 ) ). You can consider this equal definition as a recursion.
For example:
a = " papa ", b = " apap ", we need to check if " pa " equals " ap " in Johnny ' s rule.
Therefore, we divide " pa " into "p" and "a", and divide "ap" into "a" and "p".
Then, because "p" == "p" && " a " == "a", we know that "pa" == "ap".
Hence, we can conclude that " papa " equals " apap ".
Note that we can't divide a string if the length of the string is an odd number.
Help Johnny find out whether the two string are the same. If you help him, he will give you some sugar.
Input
input contains two lines.
First line is the string a.
Second line is the string b.
the length of the two string are the same and the length is from 1~105 ( 1 <= length <= 105 )
Output
output contains one line.
print "YES" if two string is equal in Johnny's rule,
print "NO" otherwise.
remember to print \n at the end of output.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
I'm a salary thief who don't answer students' question
~by anonymous TA
"I sucked!" TA think he's the worst, therefore he only asks you to do some cut and paste.
You got a string and your cursor is at the leftmost position of the string.
Let's call the leftmost position of the string position 0.
The string only contains character '1'~'3'.
You need to move the cursor to the right x times.
Each time only cross one character.
After the move, you divide the string into two part.
You cut the right part, and paste it for n times.
For n = the last character of left part of the string.
You need to answer how long the string is after x moves.
Because the string may be very long, you only need to answer the length of the final string mod 10^9+7(output positive number)
We guarantee that each move will not on empty character.
Example:
Given x = 5, string = "231"
Move 1(position 0->1):
cut the string "231" -> "2" and "31"
the last character of left part of the string = "2"
past "31" for 2 times, we got "23131"
Move 2(position 1->2):
cut the string "23131" -> "23" and "131"
the last character of left part of the string = "3"
past "131" for 3 times, we got "23131131131"
Move 3(position 2->3):
cut the string "23131131131" -> "231" and "31131131"
the last character of left part of the string = "1"
past "31131131" for 1 times, we got "23131131131"
Move 4(position 3->4):
cut the string "23131131131" -> "2313" and "1131131"
the last character of left part of the string = "3"
past "1131131" for 3 times, we got "2313113113111311311131131"
Move 5(position 4->5):
cut the string "2313113113111311311131131" -> "23131" and "13113111311311131131"
the last character of left part of the string = "1"
past "13113111311311131131" for 1 times, we got "2313113113111311311131131"
The final string "2313113113111311311131131" has length 25.
The answer will be 25%(10^9+7) = 25

Input
First line contains one integer t(1 <= t <= 10) which means the number of testcases.
Each testcase contains two lines.
First line contains one integer x(1 <= x <= 10^6)
Second line contains a string. ( 1 <= length of the string <= 500)
Output
For each testcase, print only one positive number which means the length of the final string mod 10^9+7
Remember to print \n at the end of output.