2019 Tenth Blue Bridge Cup JavaB Group Provincial Games Zhenti Detailed Explanation

Blue Bridge Cup calendar year true title summary and topic details

Blue Bridge Cup calendar year final test summary and test questions

table of Contents

First question: Team

Question 2: Different substrings

The third question: the evaluation of the series

Fourth question: decomposition of numbers

Problem 5: Maze

Question 6: The sum of special numbers

Question 7: Takeaway shop priority

Eighth question: Analysis of character correlation

Ninth Question: Postfix Expression

Tenth question: Psionic transmission


Problem to be updated

First question: Team

Description of the topic

As a basketball team coach, you need to select one player from the 1st to the 5th position to form the team's starting lineup.

The scores for each player from the 1st to the 5th are shown in the table below. Please calculate the maximum number of ratings for the starting lineup from the 1st to the 5th position.

(If you copy the above text into a text file, please be sure to check whether the copied content is consistent with the one in the document. There is a file team.txt in the test directory, the content is the same as in the above table, please note that the first column is Numbering)

[answer submission]
This is a question that fills in the blanks. You only need to figure out the results and submit them. The result of this question is an integer. Only fill in the integer when submitting the answer. If you fill in the extra content, you will not be able to score.

Question 2: Different substrings

Description of the topic

A non-empty substring of a string is a string of consecutive characters of at least 1 in the string. For example, the string aaab has a non-empty substring a, b, aa, ab, aaa, aab, aaab, a total of seven. Note that in the calculation, only the number of strings that are essentially different is counted.

Excuse me, how many different non-empty substrings does the string 0100110001010001 have?

[answer submission]
This is a question that fills in the blanks. You only need to figure out the results and submit them. The result of this question is an integer. Only fill in the integer when submitting the answer. If you fill in the extra content, you will not be able to score.

The third question: the evaluation of the series

Description of the topic

Given a sequence of 1, 1, 1, 3, 5, 9, 17, ..., starting with item 4, each item is the sum of the first three items. Find the last 4 digits of item 20190324.
[answer submission]
This is a question that fills in the blanks. You only need to figure out the results and submit them. The result of this question is a 4-digit integer (hint: the thousand digits of the answer is not 0), only fill in the integer when submitting the answer, and the extra content will not be scored.

Fourth question: decomposition of numbers

Description of the topic

Decompose 2019 into the sum of three different positive integers, and require that each positive integer does not contain the numbers 2 and 4. How many different decomposition methods are there?

Note that the order in which three integers are exchanged is treated as the same method, for example, 1000+1001+18 and 1001+1000+18 are treated as the same.
[answer submission]
This is a question that fills in the blanks. You only need to figure out the results and submit them. The result of this question is an integer. Only fill in the integer when submitting the answer. If you fill in the extra content, you will not be able to score.

Problem 5: Maze

Description of the topic

The figure below shows a plan view of a labyrinth with the marker 1 as the obstacle and the marker 0 as the passable.
010000                                                                                                                                                                                      000100                                                                                                                                                                                      001001                                                                                                                                                                                    110000
The entrance to the labyrinth is the upper left corner and the exit is the lower right corner. In the labyrinth, it can only go from one position to one of its four directions of up, down, left and right.

For the labyrinth above, starting from the entrance, you can pass the maze in the order of DRRURRDDDR for a total of 10 steps. Where D, U, L, and R respectively indicate downward, upward, leftward, and rightward.

For the more complicated maze below (30 rows and 50 columns), find a way to pass the maze, which uses the fewest steps. Under the premise of the minimum number of steps, find the smallest one in the lexicographical order as the answer. Note that D<L<R<U in the lexicographical order. (If you copy the following text into a text file, be sure to check that the copied content is consistent with the one in the document. There is a file maze.txt in the question directory, the content is the same as the text below)

01010101001011001001010110010110100100001000101010                                                                                                    00001000100000101010010000100000001001100110100101                                                                                                    01111011010010001000001101001011100011000000010000                                                                                                      01000000001010100011010000101000001010101011001011                                                                                                    00011111000000101000010010100010100000101100000000                                                                                                    11001000110101000010101100011010011010101011110111                                                                                                        00011011010101001001001010000001000101001110000000                                                                                                  10100000101000100110101010111110011000010000111010                                                                                                        00111000001010100001100010000001000101001100001001                                                                                                  11000110100001110010001001010101010101010001101000                                                                                                      00010000100100000101001010101110100010101010000101                                                                                                  11100100101001001000010000010101010100100100010100    00000010000000101011001111010001100000101010100011                                                                                                      10101010011100001000011000010110011110110100001000      10101010100001101010100101000010100000111011101001                                                                                                      10000000101100010000101100101101001011100000000100    10101001000000010100100001000100000100011110101001                                                                                                      00101001010101101001010100011010101101110000110101            11001010000100001100000010100101000001000111000010                                                                                                      00001000110000110101101000000100101001001000011101          10100101000101000000001110110010110101101010100001              00101000010000110101010000100010001001000100010101                                                                                                      10100001000110010001000010101001010101011111010010   00000100101000000110010100101001000001000000000010                11010000001001110111001001000011101001011011101000                                                                                                         00000110100010001000100000001000011101000000110011            10101000101000100010001111100010101001010000001000  10000010100101001010110000000100101010001011101000                                                                                                        00111100001000010000000110111000000001000000001011                  10000001100111010111010001000110111010101101111000    

The data may have alignment problems, here I give a screenshot of the data:

[answer submission]
This is a question that fills in the blanks. You only need to figure out the results and submit them. The result of this question is a string containing four letters D, U, L, and R. When submitting the answer, only fill in the string, and filling in the extra content will not be able to score.

Question 6: The sum of special numbers

Description of the topic

Xiao Ming is interested in numbers with 2, 0, 1, 9 in the digits (excluding leading 0). In 1 to 40, such numbers include 1, 2, 9, 10 to 32, 39, and 40, for a total of 28 Their sum is 574.

Excuse me, what is the sum of all such numbers in 1 to n?


[input format]

The input line contains two integers n.


[Output format]


Outputs a line containing an integer representing the sum of the numbers that satisfy the condition.


[sample input]

40

[Sample output]

574


[Evaluation use case size and convention]

For 20% of the evaluation cases, 1 ≤ n ≤ 10.

For 50% of the evaluation cases, 1 ≤ n ≤ 100.

For 80% of the evaluation cases, 1 ≤ n ≤ 1000.

For all evaluation cases, 1 ≤ n ≤ 10000.

Time limit: 1.0s

Memory limit: 512.0MB

Question 7: Takeaway shop priority

Description of the topic

The “satisfying” takeaway system maintains N takeaway stores, number 1 ∼ N. Each takeaway store has a priority, and the initial (0 time) priority is 0.

For each time unit, if there is no order in the take-away store, the priority will be reduced by 1, and the minimum will be reduced to 0. If there is an order in the take-away store, the priority will not be reduced, and each priority will be increased by 2.

If a takeaway store has a priority greater than 5 at a certain time, it will be added to the priority cache by the system; if the priority is less than or equal to 3, the priority cache will be cleared.

Given the M order information within the T time, please calculate how many take-away stores are in the priority cache at time T.

[Input format]

The first line contains 3 integers N, M, and T.
 
The following M lines contain two integers ts and ids per line, indicating that the take-out store with the ts time number id received an order.

[Output format]

Output an integer to represent the answer.

[sample input]

2 6 6 
1 1 
5 2 
3 1 
6 2 
2 1 
6 2

[Sample output]

1

[example explanation]

At 6 o'clock, the priority of store 1 dropped to 3, and the priority cache was removed; the priority of store 2 rose to 6, and the priority cache was added. So there is 1 store (No. 2) in the priority cache.

[Evaluation use case size and agreement]
 
For 80% of the evaluation cases, 1 ≤ N, M, T ≤ 10000.
For all evaluation cases, 1 ≤ N, M, T ≤ 100000, 1 ≤ ts ≤ T, 1 ≤ id ≤ N.

Time limit: 1.0s

Memory limit: 512.0MB

Eighth question: Analysis of character correlation

Description of the topic

Xiao Ming is analyzing the character relevance in a novel. He wondered how many times Alice and Bob appeared in the novel at the same time.


More precisely, Xiaoming defines Alice and Bob as "simultaneously appearing": no more than K characters between Alice and Bob in the novel text.


For example, the following text:


ThisisastoryaboutAliceandBob.AlicewantstosendaprivatemessagetoBob. 


Assuming K = 20, Alice and Bob appear twice at the same time, namely "Alice and Bob" and "Bob. Alice". The former has 5 characters between Alice and Bob, and the latter has 2 characters.


Note:

1. Alice and Bob are case-sensitive, and alice or bob are not counted.
2. Alice and Bob should be separate words, with punctuation and spaces before and after, but no letters. For example, Bobbi does not appear to have Bob.

[Input format]

The first line contains an integer K.
The second line contains a line of strings containing only uppercase and lowercase letters, punctuation, and spaces. The length does not exceed 1000000.

[Output format]

Outputs an integer indicating the number of simultaneous occurrences of Alice and Bob.

[sample input]

20 
ThisisastoryaboutAliceandBob.AlicewantstosendaprivatemessagetoBob.

[Sample output]
 
2

[Evaluation use case size and agreement]

For all evaluation cases, 1 ≤ K ≤ 1000000.

Time limit: 1.0s

Memory limit: 512.0MB

Ninth Question: Postfix Expression

Description of the topic

Given N plus signs, M minus signs, and N + M + 1 integers A1, A2, ··· , AN+M+1, Xiao Ming wants to know all the N plus signs, M minus signs, and Which of the following is the legal suffix expression for N + M +1 integers?

Please output this maximum result.
 
For example, if you use 1 2 3 + -, the result of the "2 3 + 1 -" suffix expression is 4, which is the largest.

[Input format]

The first line contains two integers N and M. The second line contains N + M + 1 integers A1, A2, ···, AN+M+1.

[Output format]

Output an integer representing the answer.

[sample input]

1 1 
1 2 3

[Sample output]

4

[Evaluation use case size and agreement]

For all evaluation cases, 0 ≤ N, M ≤ 100000, −109 ≤ Ai ≤ 109.

Time limit: 1.0s

Memory limit: 512.0MB

Tenth question: Psionic transmission

Description of the topic

[Title background]
 
In the game "StarCraft II", the high-level Templar as an important AOE unit of the Protoss plays an important role in the middle and late stages of the game, and its skill "Psychic Storm" It can consume a lot of psionic power to cause devastating damage to enemy units in an area. A low-blood unit often used to fight human biochemical forces and Zerg's Hydralisks.

【Problem Description】

You control the n high-ranking Templars, which are conveniently marked as 1,2,···, n. Every high-ranking Templar requires a certain amount of psionic power to fight. Everyone has a psionic value ai to indicate how much psionic power they have (ai non-negative means that this high-ranked Templar is more than optimal in the best condition. Ai point psionic, ai negative means that this high-ranking templar also needs −ai point psionic to reach the best combat state). Now the system gives your high-ranking Templar an ability to pass psionic power. Each time you can choose an i ∈ [2,n−1], if ai ≥ 0, then the high-level Templars on both sides, that is I−1, i + 1 These two high-ranking Templars will draw ai point psionic power from i, the high-ranking Templar; if ai < 0, the high-ranking Templars on both sides, ie i −1,i+1 These two high-ranking Templars will give i the high-ranking Templar-ai point psionic power. In terms of form, it is ai−1+ = ai, ai+1+ = ai, ai−= 2ai.

Psionic energy is a very efficient combat tool, and it is also very dangerous and unstable. A high-level Templar has more or less psionic power, and defines the instability of a group of high-ranking Templars. Maxn i=1|ai|, please limit the instability of this group of high-level Templars you control through an unlimited number of psionic manipulations.

[Input format]

This question contains multiple sets of inquiries. The first line of the input contains a positive integer T to indicate the number of query groups. Next, enter each group of queries in turn. The first line of each group of queries contains a positive integer n, indicating the number of high-level Templars. The next line contains n numbers a1, a2, ···, an.

[Output format]

Output T lines. An integer per line in turn represents the answer to each group of queries.

[sample input]



5 -2 3 

0 0 0 0 

1 2 3
[Sample output]



3

[Sample Description]

For the first group of inquiries:
After the transfer operation of the No. 2 high-ranking Templar, a1 = 3, a2 = 2, and a3 = 1. The answer is 3.
 
For the second set of queries:
The psionic power of this group of high-ranking Templars is just right for them to reach the best battle.

[sample input]


-1 -2 -3 7 

2 3 4 -8 

-1 -1 6 -1 -1

[Sample output]



4

[sample input]

See the file trans3.in.

[Sample output]
 
See the file trans3.ans.

[Data size and agreement]

For all evaluation cases, T ≤ 3, 3 ≤ n ≤ 300000, | ai | ≤ 109.
The test will use 25 evaluation cases to test your program. The limits for each evaluation case are as follows:

Note: Please use the fast reading method for the input of this question.

Time limit: 5.0s

Memory limit: 512.0MB

Intelligent Recommendation

2018 Ninth Blue Bridge Cup JavaB Group Provincial Competition Zhenti and Detailed

2018 Ninth Blue Bridge Cup JavaB Group Provincial Competition Zhenti and Detailed Question 1: Days The second question: square counting The third question: complex power Question 4: Number of tests Qu...

The 8th Blue Bridge Cup Provincial Games JavaB Group - Solitaire Triangle

The 8th Blue Bridge Cup Provincial Games JavaB Group - Solitaire Triangle Solitaire triangle Thought Solitaire triangle Title: Solitaire Triangle A, 2, 3, 4, 5, 6, 7, 8, 9 A total of 9 cards are arran...

The 6th Provincial Games Blue Bridge Cup JavaB Group Solution

The water entered the finals, and it was a special blog. Let's review the finals for May. - The first question is not much to say Second question Third question Fourth question Fifth question Sixth qu...

Blue Bridge Cup 8th Provincial Games JavaB Group Solution

first question Use excel to calculate the fastest Second question The violent law can also use the full arrangement plus check, the full arrangement plus check I did not write, in the previous topic T...

2019 Tenth Blue Bridge Cup Provincial Same Java A Group Zhenti Analysis (Belt Source Code and Analysis)

Blue Bridge Cup Follow Year Test and Analysis. table of Contents: Blue Bridge Cup Capacity Topics and Analysis. A: Square and (difficulty: ★) topic: analysis: Code: B: Digital Request (difficulty: ★) ...

More Recommendation

[Blue Bridge Cup Provincial Javab Group True Detail] Team (2019)

Topic description Team As a basketball team, you need to select one player from the following list. Composition of the team's starting lineup. Each player serves as the 1st to 5 positions as shown in ...

2019 Tenth Blue Bridge Cup [c/c++] Group B Provincial Games Solution + Impressions (continuous update)

First introduce my personal background: I am a freshman, two ordinary students in the college. In the summer vacation, I watched the video and finished the c language. From September last year to Marc...

Detailed explanation of the real questions in the 2015 6th Blue Bridge Cup JavaB Group Provincial Competition

2015 6th Blue Bridge Cup JavaB Group Provincial Competition Real Questions and Detailed Explanations Question 1: Area of ​​the triangle Question 2: The cube becomes itself The third question: Three sh...

Detailed explanation of the real questions of the 2013 4th Blue Bridge Cup JavaB Group Provincial Competition

Detailed explanation of the real questions of the 2013 4th Blue Bridge Cup JavaB Group Provincial Competition Question 1: Week at the end of the century The second question: sloppy calculations Questi...

2018 Provincial Blue Bridge Cup JavaB Group

First question: the first few days solution: Second question: check the grid As shown in Figure p1.png, there are countless small 1x1 squares on the 2D plane. We draw a circle with a radius of 1000 ce...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top