2014 5th Java Group B Blue Bridge Cup Provincial Competition Real Questions

Here is the topic column of the Blue Bridge Cup over the years. It will be updated and will release the real questions and answers from previous years. Welcome friends to pay attention to me. Your likes and attention are the best motivation for me! ! !
Update one real question every day, so stay tuned

Lanqiao Cup Past Papers and Detailed Answers


The first question: Wugong Cheats

Title Description
Xiao Ming went to X cave to explore and found a damaged martial arts cheat book (more than 2000 pages! Of course it is forged). He noticed that the 10th and 11th pages of the book are on the same paper, but the 11th and 12th pages are not on the same paper.
Xiao Ming only wants to practice martial arts from page 81 to page 92 of the book, but doesn't want to bring the whole book. May I ask how many pieces of paper he must tear off at least to take away?
This is an integer, please submit the number through your browser, and do not fill in any extra content.
Topic analysis
topic codes



Question 2: Cutting noodles

Topic description:
A high-gluten ramen noodles, cut in the middle, you can get 2 noodles.
If you fold it in half and cut it in the middle, you can get 3 noodles.
If you fold in half twice and cut in the middle, you can get 5 noodles.
So, how many noodles will you get if you fold in half 10 times and cut in the middle?
The answer is a whole number, please submit the answer through the browser. Don't fill in any redundant content.
Topic analysis
topic codes



Question 3: Guess the letter

Title description
Repeat the sequence consisting of 19 letters of abcd...s to splice 106 times to obtain a string of length 2014. Next, delete the first letter (that is, the initial letter a), as well as the third and fifth letters in all odd positions. The obtained new string then performs the action of deleting the odd-numbered letters. If this continues, there is only one letter left. Please write that letter.
The answer is a lowercase letter, please submit the answer via a browser. Don't fill in any redundant content.
Topic analysis
topic codes



Fourth question: Dayan sequence

Title Description In
ancient Chinese documents, there was a record of "Dayan Sequence", which was mainly used to explain the derivative principles of Tai Chi in traditional Chinese culture. Its first few items are:
0, 2, 4, 8, 12, 18, 24, 32, 40, 50... The rule is: for even items, the square of the serial number is divided by 2, and the odd item is the square of the serial number minus 1. Divide by 2.
The following code prints the first 100 items of the Dayan sequence.

for(int i=1; i<100; i++)
{
    
    
    if(________________)  //填空
        System.out.println(i*i/2);
    else
        System.out.println((i*i-1)/2);
}

Topic analysis
topic codes



Question 5: Pi

Title Description In the
history of mathematical development, there have been many interesting and even legendary stories about the calculation of Pi. Many of these methods involve infinite series.
As shown in Figure 1.png, it is a method of calculating pi expressed in the form of continued fractions.
The following program implements this solution method. In fact, the convergence of the sequence is not sensitive to the initial value of x.
The result prints out the approximate value of pi (retain 4 digits after the decimal point, which does not necessarily match the true value of pi).

    double x = 111; 
    for(int n = 10000; n>=0; n--){
    
    
        int i = 2 * n + 1;
        x = 2 + (i*i / x);
    }
    
    System.out.println(String.format("%.4f", ______________));

Insert picture description here

Topic analysis
topic codes



Question 6: Strange Fraction

Title description When
in elementary school, Xiao Ming often invented new algorithms by himself. Once, the teacher asked the question:
1/4 multiplied by 8/5.
Xiao Ming actually spliced ​​the numerators together and the denominators together. The answer was: 18/45 (see Figure 1.png). The
teacher just wanted to criticize him, so I changed my mind. Thinking, this answer happens to be right, what a hell!
For the case where the numerator and denominator are both a single digit from 1 to 9, what other formulas can be calculated like this?
Please write down the number of all different calculations (including the examples in the question).
Obviously, after exchanging the numerator and denominator, for example: 4/1 multiplied by 5/8 is enough to meet the requirements, which counts as a different formula.
But for the same numerator and denominator, 2/2 multiplied by 3/3 are too many types to count!
Insert picture description here

Note: The answer is an integer (considering symmetry, it must be an even number). Please submit via browser. Don't write extra content.
Topic analysis
topic codes



Question 7: Poker sequence

Title description
AA 2 2 3 3 4 4, a total of 4 pairs of playing cards. Please line them up.
Requirements: There is 1 card between two aces, 2 cards between two 2s, 3 cards between two 3s, and 4 cards between two 4s. Please fill in the lowest lexicographic order among all the permutations that meet the requirements.
For example: 22AA3344 is lexicographically smaller than A2A23344. Of course, they are not the answer to the requirements.
Please submit your answers via your browser. "A" must not use lowercase a, and do not use "1" instead. Do not leave spaces between characters.
Topic analysis
topic codes



Question 8: Dividing candies

Title description
There are n children sitting in a circle. The teacher gave each child an even number of candies at random, and then played the following game:
each child divided his candies into half to the child on his left.
After a round of sugar splitting, the child with an odd number of candies will be given an even number by the teacher.
Repeat this game until all children have the same number of candies.
Your task is to predict how many candies the teacher needs to reissue under the known initial candies.
[Format requirements] The
program first reads an integer N (2<N<100), which represents the number of children.
Then there is a line of N even numbers separated by spaces (each even number is not greater than 1000, not less than 2), which
requires the program to output an integer, indicating the number of candies that the teacher needs to reissue.
For example: input
3
2 2 4 and the
program should output:
4

Resource agreement:
peak memory consumption (including virtual machines) <256M
CPU consumption <1000ms

Topic analysis
topic codes



Question 9: Taking treasure from the underground palace

Title description
King X has a treasure trove of underground palaces. Is a matrix of nxm grids. Put a baby in each grid. Each baby is affixed with a value label. The entrance to the underground palace is in the upper left corner, and the exit is in the lower right corner. Xiao Ming was taken to the entrance of the underground palace, and the king asked him to walk to the right or down. When walking through a grid, if the value of the treasure in that grid is greater than that of any treasure in Xiao Ming's hands, Xiao Ming can pick it up (of course, you don't need to take it). When Xiao Ming walks to the exit, if the treasures in his hand happen to be k pieces, these treasures can be given to Xiao Ming.
Please help Xiaoming calculate how many different action plans he has to obtain these k treasures in a given situation.
[Data format]
Enter 3 integers in a row, separated by spaces: nmk (1<=n,m<=50, 1<=k<=12)
Next, there are n rows of data, each row has m integers Ci (0 <=Ci<=12) represents the value of the treasure on this grid. It is
required to output an integer, which means that the number of action plans for k treasures is taken. This number may be very large, and output the result of modulo 1000000007.

For example, input:
2 2 2
1 2
2 1 The
program should output:
2

For another example, input:
2 3 2
1 2 3
2 1 5 The
program should output:
14

Resource agreement:
peak memory consumption (including virtual machine) <256M
CPU consumption <2000ms
question analysis
question code



Question 10: Turning the coin over the matrix

Title description
Xiao Ming first put the coins into a matrix with n rows and m columns. Subsequently, Xiao Ming performs a Q operation on each coin. The definition of Q operation on the coin in row x and column y: flip all coins in row i x and column j y. Among them, i and j are any positive integers that make the operation feasible, and the row number and column number both start from 1. When Xiao Ming performed a Q operation on all the coins, he found a miracle-all the coins were heads up. Xiao Ming wanted to know how many coins were facing up at the beginning. So he asked his good friend Xiao M for help. The smart little M tells Xiaoming that he only needs to perform the Q operation on all coins again to restore to the initial state. However, Xiao Ming is lazy and unwilling to follow suit. So Xiao Ming hopes you will give him a better way. Help him calculate the answer.

[Data format] The
input data contains one line, two positive integers nm, and the meaning is shown in the title description.
Output a positive integer, indicating how many coins are facing up at the beginning.

【Sample input】
2 3

【Sample output】
1

[Data scale]
For 10% of data, n, m <= 10^3;
for 20% of data, n, m <= 10^7;
for 40% of data, n, m <= 10^15;
for For 10% of the data, n, m <= 10^1000 (10 to the 1000 power).

Resource agreement:
peak memory consumption (including virtual machine) <256M
CPU consumption <2000ms
question analysis
question code



Guess you like

Origin blog.csdn.net/kiwi_berrys/article/details/111492187