| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11591 | Book Donation Program |
|
| 11592 | Change the Cap |
|
| 11593 | Mexican Wave |
|
Description
Twilight Sparkle is an aspiring pony lives in Equestria. She has a large collection of books, all of which are stored in bookcases in her house. For each bookcase, the books stored in it is labelled 1, 2, 3, .... and so on.
One day, she decides to participate in a book donation program. For each bookcase in her house, she wants to pick up one book for donation.
Here is how Twilight chooses the books :
Each time she will ask her friend Spike to give her two random number x and n. Twilight wants to find out the n-th smallest prime p that is equal or greater than x. For this bookcase, Twilight will then pick up the book labelled p for donation.
Since Twilight is not good at mathematics, she asks you to write a program to calculate the answer of all bookcases. If the program is correct, Twilight will be happy and she may teach you some magic tricks.
Input
First line contains one integer T, representing the number of the bookcases.
The next T lines contains two integers x, n, representing the two numbers Spike gives to Twilight.
1 <= T <= 100
1 <= x <= 105
1 <= n <= 1000
Output
For each bookcase, please output a line contains one integer p, representing the label of the book that is donated.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Johnson, a pro table tennis player, is a member of school team in NTHU. The coach trains the whole team three times a week. After training, Johnson needs to drink a lot of sports drinks named "Fin & Bubblegum" (also known as "F&B").
One day, the company decides to hold a long-term promotion. After you collect three caps from the bottle, you can return them back to the company and get a new bottle of "F&B".
Johnson notices that he needs to drink N bottle of "F&B" every week. He would like to know the minimum number of "F&B" he needs to buy every week.
If you can solve this problem, maybe Johnson will teach you how to play table tennis.
For this problem, you don't need to calculate the remaining caps from last week.
Attention : Johnson found out that some programs may give him wrong answer in some other cases, so he decided to add more testcases to ensure the correctness of your program. (rejudge in 10/5 18:20)
Input
There is only one integer for each testcase.
1 <= N <= 104
Output
Please output the minimum number of "F&B" Johnson needs to buy every week.
Remember to print '\n' after your answer.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
James, a pro photographer, recently went to a baseball game. He was very interested in Mexican wave, so he decided to take some photos of it.
Image that there are n spectators in the stadium, labelled from 1 to n. The maximum length of the wave is m. The spectators start the Mexican wave at time 0.
- At time 1, the first spectator stands.
- At time 2, the second spectator stands.
- ...
- At time m, the m-th spectator stands.
- At time m + 1, the (m + 1)-th spectator stands and the first spectator sits.
- At time m + 2, the (m + 2)-th spectator stands and the second spectator sits.
- ...
- At time n, the n-th spectator stands and the (n - m)-th spectator sits.
- At time n + 1, the (n + 1 - m)-th spectator sits.
- ...
- At time n + m, the n-th spectator sits.
Now, James prints out T pictures he took and wants to play a game with you. For each picture, James will give you n, m, and the time t he took the picture. Can you predict how will picture looks like?
If you win the game, maybe James will teach you some tips about shooting an astonishing picture.
Input
The first line contains one integer number T, representing the numbers of photos.
The next T lines contain three integers n, m, t, representing the number of spectators, the maximum length of the wave, and the time James took the picture.
1 <= T <= 100
1 <= m <= n <= 100
0 <= t <= 100
Output
For each picture please output a line contains n characters, representing the states of the n spectators. If a spectator is sitting, please print '-', otherwise please print '^'. You can find out more information in sample output.