<> The 11th Blue Bridge Cup software provincial competition

<> test questions A: Running training

Total score of this question :5 branch

【 Problem description 】

Xiao Ming is going to do a running training .

Initial time , Xiao Ming is full of energy , Physical strength is calculated as 10000. If Xiao Ming runs , Loss per minute

600 Physical strength . If Xiao Ming has a rest , Increase per minute 300 Physical strength . The loss and increase of physical strength are

Uniformly varying .

Xiao Ming is going to run for a minute , Take a minute off , Run for another minute , Take another minute off …… So follow

ring . If Xiao Ming's physical strength arrives at a certain time 0, He stopped exercising .

How long will Xiao Ming stop exercising . To make the answer an integer , Please output the answer in seconds .

Only fill in the number in the answer , Do not fill in company .

【 Answer submission 】

This is a result filling question , You just need to calculate the results and submit them . The result of this question is a

integer , Only fill in this integer when submitting the answer , If you fill in extra content, you will not be able to score .

Problem solution

You can count by mouth here : The answer is :3880
10000 / (600-300) == 33.33 33*(600-300) = 9900 10000 - 9900 + 300 = 400 < 600
So the time is 32*2*60 + 400/10 = 3880
Program simulation :
energy = 10000 min = 0 second = 0 while(energy): min += 1 if min % 2 == 1: if
energy> 600 : energy -= 600 else: min -= 1 second = energy/10 energy = 0 else:
energy+= 300 if energy <= 0: break print(min*60+second)
<> test questions B: anniversaries of important events

Total score of this question :5 branch

【 Problem description 】

2020 year 7 month 1 Day is ***( Sensitive word ) establish 99 Anniversary .

***( Sensitive word ) Founded in 1921 year 7 month 23 day .

Excuse me from 1921 year 7 month 23 Sunday noon 12 When to 2020 year 7 month 1 Sunday noon 12 When the total package

How many minutes ?

【 Answer submission 】

This is a result filling question , You just need to calculate the results and submit them . The result of this question is a

integer , Only fill in this integer when submitting the answer , If you fill in extra content, you will not be able to score .

Problem solution

Let's go straight to the program , perhaps Excel Dafa is OK . Used here Python Convenient point , Fill in the blanks ,Python Code is :
def fun(year): if (year%4==0 and year%100!=0) or year%400==0: return 366 return
365 day = 0 for i in range(1922,2021): day += fun(i) # 1921.7.23 reach 2020.7.23 Number of days
# Further reduction 22 day day = day - 22 min = day * 24 * 60 print(min)
answer :52038720

<> test questions C: Merge detection

Total score of this question :10 branch

【 Problem description 】

***( Sensitive word ) from ***( Sensitive word ) cause , Recently in A National spread , In order to control as soon as possible ***( Sensitive word ),A
China is ready to test a large number of people for virus nucleic acid . however , Kits for testing are in short supply . In order to solve this difficulty , Scientists have come up with an idea : Merge detection . Coming from multiple people (k individual ) The collected samples are put into the same kit for testing . If the result is negative , This means that
k Everyone is negative , It's done with a kit k Personal testing . If the result is positive , At least one person is positive , This needs to be k All individual samples were retested independently ( In theory , If before testing
k 1 If individuals are negative, it can be inferred that k Individuals are positive , However, this inference will not be used in practice , But will k Individual independent testing ), Plus the initial merge detection , A total of k + 1
A kit is complete k Personal testing .A China estimates that the infection rate of the people tested is about 1%, Evenly distributed . Excuse me? k How many kits can you save most ?

【 Answer submission 】

This is a result filling question , You just need to calculate the results and submit them . The result of this question is a

integer , Only fill in this integer when submitting the answer , If you fill in extra content, you will not be able to score .

Problem solution
This is a mathematical problem Set the total number as pop, infection rate p, every time k people , Total city series sum sum = ([pop/k]+1)*(1+k*p(k+1)) there [pop/k]+1)
Namely pop/k Round up [pop/k]+1) Here because pop Large quantity , So it's rounded up here 1 Can be ignored , Take it directly here pop/k, Namely sum = (pop/k)*(1+
kp(k+1)) take p Substitute in sum = (pop/k)*(1+k*0.01(k+1)) sum Derivation = (pop/k)(0.01k-1/k) Appropriate k = 10
Time ,sum Take the minimum value therefore K= 10
answer :10

<> test questions D: REPEAT program

Total score of this question :10 branch

【 Problem description 】

enclosure prog.txt Is a program written in a certain language .

among REPEAT k Indicates that a number of times is k Cycle of . The range of loop control is expressed by indentation ,

The number of consecutive indents from the next line that are greater than that line ( The space in front is longer ) Content included for the loop .

For example, the following fragment :

REPEAT 2:

A = A + 4

REPEAT 5:

REPEAT 6:

A = A + 5

A = A + 7

A = A + 8

A = A + 9

From this clip A = A + 4 Line to A = A + 8 All lines are in the first line

In two cycles .

REPEAT 6: Line to A = A + 7 All the lines are in REPEAT 5: In circulation .

A = A + 5 The actual total number of cycles is 2 × 5 × 6 = 60 second .

After the execution of the program ,A What is the value of ?

【 Answer submission 】

This is a result filling question , You just need to calculate the results and submit them . The result of this question is a

integer , Only fill in this integer when submitting the answer , If you fill in extra content, you will not be able to score .

Problem solution

This question is to fill in the blanks , So we can still use Python To deal with it , It can be more convenient , current ,C/C++ It's OK , Here is an example Python Handling method of version
dir = '/Users/qiguan/Downloads/C++ university B group /REPEAT program .txt' file = open(dir) data =
file.read() len = data.__len__() def get_indent(i): now_indent = 0 while data[i]
== ' ': now_indent = now_indent + 1 i = i + 1 return now_indent, i def get_flag(
i): if data[i] == 'R': i = i + 7 return 1, i if data[i] == 'A': i = i + 8 return
2, i # The number of indented spaces before the line in the current process indent = 0 # Control subscript i = 5 # A Value of A = 0 # multiplier multiplier = 1 #
multiplier aggregate multiplier_list= [] flag = 0 while i != len: if data[i] == '\n': i = i + 1
if i >= len -1: break now_indent, i = get_indent(i) flag, i = get_flag(i) if
now_indent< indent: multiplier /= multiplier_list[-1] multiplier_list.pop() if
flag== 1: multiplier *= int(data[i]) multiplier_list.append(int(data[i])) i += 2
# A = A + if flag == 2: A += int(data[i])*multiplier i += 1 indent = now_indent
print(A)
answer :241830

<> test questions E: matrix

Total score of this question :15 branch

【 Problem description 】

hold 1 ∼ 2020 Put on 2 × 1010 In the matrix . The right side of the same line is required to be larger than the left , same

The lower column is larger than the upper one . How many options are there ?

The answer is big , You just need to give the number of schemes divided by 2020 The remainder of .

【 Answer submission 】

This is a result filling question , You just need to calculate the results and submit them . The result of this question is a

integer , Only fill in this integer when submitting the answer , If you fill in extra content, you will not be able to score .

Problem solution
#include <iostream> using namespace std; int main(){ int (*dp)[1011] = new int
[2021][1011]; dp[1][1] = 1; for (int i = 2; i <= 2020; ++i) { for (int j = 1; j
<= i; ++j) { dp[i][j] += dp[i-1][j-1]; if(i-j<=j){ dp[i][j] += dp[i-1][j]; } dp[
i][j] %= 2020; } } cout<<dp[2020][1010]; return 0; }
answer :1340

<> test questions F: Divisible sequence

time limit : 1.0s Memory limit : 256.0MB Total score of this question :15 branch

【 Problem description 】

There is a sequence , The first number in the sequence is n, Each subsequent number is divided by the previous number 2, Please enter

Find the items with positive values in this sequence .

【 Input format 】

The input line contains an integer n.

【 Output format 】

Output one line , Contains multiple integers , Adjacent integers are separated by a space , Indicates the answer .

【 sample input 】

20

【 sample output 】

20 10 5 2 1

【 Scale and agreement of evaluation cases 】

about 80% Evaluation cases for ,1 ≤ n ≤ 10^9.

For all profiling cases ,1 ≤ n≤ 10^18.

Problem solution
#include <iostream> using namespace std; int main(){ long long int n; cin>>n;
while(n){ // Large amount of output data , use printf Better // In the Blue Bridge Cup system ,lld Should be used %I64d printf("%lld ",n); n =
n>>1; } return 0; }
<> test questions G: decode

time limit : 1.0s Memory limit : 256.0MB Total score of this question :20 branch

【 Problem description 】

Xiao Ming has a long string of English letters , May contain uppercase and lowercase .

In this string of letters , There are many consecutive ones that are repeated . Xiao Ming thought of a way to put the alphabet

Reach shorter : Write consecutive identical letters into letters + Form of number of occurrences .

for example , successive 5 individual a, Namely aaaaa, Xiao Ming can be abbreviated as a5( It may also be abbreviated to a4a,

aa3a etc. ). For this example :HHHellllloo, Xiao Ming can be abbreviated as H3el5o2. For the convenience of the watch

reach , Xiao Ming will not continuously exceed 9 Write the same characters in short form .

Now give the abbreviated string , Please help Xiao Ming restore the original string .

【 Input format 】

The input line contains a string .

【 Output format 】

Output a string , Represents the restored string .

【 sample input 】

H3el5o2

【 sample output 】

HHHellllloo

【 Scale and agreement of evaluation cases 】

For all profiling cases , The string consists of upper and lower case English letters and numbers , Length not exceeding

100.

Please note that the original string length may exceed 100.

Problem solution
#include <iostream> #include <string> #include <cstring> #include <cstdio>
using namespace std; int main(){ string a; getline(cin,a); int len = a.length();
string re= ""; bool flag = false; for(int i = 0 ; i < len;i++){ if(a[i] < '2'
|| a[i] > '9'){ re = re + a[i]; flag = true; } else{ // The previous one is not 2-9, And this time 2-9 number if(
flag){ int num = int(a[i] - '0') - 1; for (int j = 0; j < num; ++j) { re = re +
a[i-1]; } flag = false; } else{ re = re + a[i]; } } } cout<<re; return 0; }
<> test questions H: Walk grid

time limit : 1.0s Memory limit : 256.0MB Total score of this question :20 branch

【 Problem description 】

There are some two-dimensional lattice on the plane .

These points are numbered like two-dimensional arrays , From top to bottom 1 To n that 's ok ,

From left to right 1 To m column , Each point can be represented by row number and column number .

Now there is a man standing on the second floor 1 Line number 1 column , To go to the third n Line number m column . Only right or down

go .

be careful , If the number of rows and columns are even , You can't go into this space .

How many options are there .

【 Input format 】

The input line contains two integers n, m.

【 Output format 】

Output an integer , Indicates the answer .

【 sample input 】

3 4

【 sample output 】

2

【 sample input 】

6 6

【 sample output 】

0

【 Scale and agreement of evaluation cases 】

For all profiling cases ,1 ≤ n ≤ 30, 1 ≤ m ≤ 30.

Problem solution
#include <iostream> #include <vector> using namespace std; int main(){ int n,m;
cin>>n>>m; vector<vector<int>> dp(n+1,vector<int>(m+1)); for(int i = 1;i <= n;i
++){ dp[i][1] = 1; } for (int j = 1; j <= m; ++j) { dp[1][j] = 1; } for(int i =
2;i <= n;i++){ for (int j = 2; j <= m; ++j) { if(i%2==0 && j%2==0) continue;
else dp[i][j] = dp[i-1][j] + dp[i][j-1]; } } cout<<dp[n][m]; return 0; }
<> test questions I: Integer splicing

time limit : 1.0s Memory limit : 256.0MB Total score of this question :25 branch

【 Problem description 】

Define a length of n Array of A1, A2, · · · , An. You can choose two numbers from them Ai and Aj

(i Not equal to j), Then Ai and Aj Put one before another into a new integer . for example 12 and 345 can

To spell 12345 or 34512. Attention exchange Ai and Aj The order of is always regarded as 2 Spelling , even if

yes Ai= Aj Time .

Please calculate how many spellings satisfy the whole number K Multiple of .

【 Input format 】

The first line contains 2 Integer n and K.

The second line contains n Integer A1,A2, · · · , An.

【 Output format 】

An integer represents the answer .

【 sample input 】

4 2

1 2 3 4

【 sample output 】

6

【 Scale and agreement of evaluation cases 】

about 30% Evaluation cases for ,1 ≤ n≤ 1000, 1 ≤ K ≤ 20, 1 ≤ Ai ≤ 10^4.

For all profiling cases ,1 ≤ n≤ 10^5,1 ≤ K≤ 10^5,1 ≤ Ai ≤ 10^9.

<> test questions J: network analysis

time limit : 1.0s Memory limit : 256.0MB Total score of this question :25 branch

【 Problem description 】

Xiao Ming is doing a network experiment .

He set n Computer , Called node , Used for sending, receiving and storing data .

Initial time , All nodes are independent , No connection exists .

Xiao Ming can connect the two nodes through a network cable , After connection, the two nodes can communicate with each other

Yes . If there is a network cable connection between the two nodes , Called adjacency .

Xiao Ming sometimes tests the network at that time , He will send a message at a node , The message will be sent

To each adjacent node , Then these nodes will forward to their adjacent nodes , Until all direct

Or indirectly adjacent nodes have received information . All sending and receiving nodes will store the information .

A message is stored only once .

The process of Xiaoming connection and test is given , Please calculate the size of information stored on each node .

【 Input format 】

The first line of input contains two integers n,m, Indicates the number of nodes and operations respectively . Node from

1 to n number .

next m that 's ok , Three integers per line , Represents an operation .

If the operation is 1 a b, Indicates that the node will be a And nodes b Connected by network cable . When a = b

Time , Indicates that a self ring is connected , No material impact on the network .

If the operation is 2 p t, Indicates at the node p The size of the last message sent is t Information .

【 Output format 】

Output one line , contain n Integer , Adjacent integers are separated by a space , Sequential representation

After the above operations, the node 1 To node n Size of information stored on .

【 sample input 】

4 8

1 1 2

2 1 10

2 3 5

1 4 1

2 2 2

1 1 2

1 2 4

2 2 1

【 sample output 】

13 13 5 3

【 Scale and agreement of evaluation cases 】

about 30% Evaluation cases for ,1 ≤ n ≤ 20,1 ≤ m ≤ 100.

about 50% Evaluation cases for ,1 ≤ n ≤ 100,1 ≤ m ≤ 1000.

about 70% Evaluation cases for ,1 ≤ n ≤ 1000,1 ≤ m ≤ 10000.

For all profiling cases ,1 ≤ n ≤ 10000,1 ≤ m ≤ 100000,1 ≤ t ≤ 100.

Technology