<> Blue bridge cup test questions

Do it at will , There is little reference value So , For reference only

<> test questions A: Running training

Total score of this question :5 branch
【 Problem description 】
Xiao Ming is going to do a running training .
At the beginning , Xiao Ming is full of physical strength , 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 the same
Uniformly varying .
Xiao Ming is going to run for a minute , Take a minute off , Run another minute , Take another minute off …… So it follows
ring . If at some point Xiao Ming's physical strength arrives 0, He stopped exercising .
How long will Xiao Ming stop exercising . In order to make the answer integer , Please output the answer in seconds .
Only fill in the number in the answer , Do not fill in the unit .
【 Answer submission 】
This is a result filling question , You just need to work out the results and submit them . The result of this problem is a
integer , Only fill in this integer when submitting the answer , Fill in the extra content will not be able to score .
#include <iostream> using namespace std; int main() { int power = 10000; int
time= 0; int key = 1; while(power > 0) { if(key % 2 != 0) { power -= 600; time++
; } else if(key % 2 == 0) { power += 300; time++; } key++; } cout << time * 60
<<endl; return 0; }
<> test questions B: anniversaries of important events

test questions B: anniversaries of important events
Total score of this question :5 branch
【 Problem description 】
2020 year 7 month 1 Japan is the founding of the Communist Party of China 99 Anniversary .
The Communist Party of China was founded in 1921 year 7 month 23 day .
From 1921 year 7 month 23 At noon 12 It's time 2020 year 7 month 1 At noon 12 How many bags do you have
How many minutes ?
【 Answer submission 】
This is a result filling question , You just need to work out the results and submit them . The result of this problem is a
integer , Only fill in this integer when submitting the answer , Fill in the extra content will not be able to score .
try
#include <iostream> using namespace std; bool judge(int years) { if((years % 4
== 0 && years % 100 != 0 )|| years % 400 != 0) { return true; } return false; }
int main() { int time = 0; for(int year = 1920; year <= 2019 ; ++ year) { if(
judge(year)) { time += 366; continue; } time += 355; } // count 1919 Of time = time + 8
+ 31 + 30 + 31 + 30 + 31; // count 2020 Of time = time + 31 + 29 + 31 + 30 + 31 + 30 + 1
;//1 by 12 plus 12 time = time * 24 * 60; // Convert to minutes //cout << judge(2020) << endl; test
2020 Is it a leap year cout << time << endl; return 0; }
<> test questions C: Merge detection

Total score of this question :10 branch
【 Problem description 】
COVID-19 caused by COVID-19 , Recently in A National spread , In order to control the epidemic as soon as possible ,A National standard
For a large number of people into the virus nucleic acid detection .
however , Shortage of test kits .
In order to solve this problem , Scientists have come up with a way : Merge detection . Coming from multiple people (k
individual ) The collected samples were put into the same kit for detection . If the result is negative , This means that k
All of them are negative , It's done with a kit k Personal testing . If the result is positive , Then explain
At least one person is positive , It needs to be changed k All individual samples were tested independently again ( In theory ,
If before testing k - 1 All of them are negative, so we can infer the second k The individual is positive , But in practice
This inference will not be used , It will k Individual independent testing ), Add the initial merge detection , Total use
It's over k + 1 One kit is complete k Personal testing .
A China estimates that the infection rate of the people tested is about 1%, It is evenly distributed . Excuse me? k How much can I get
Most economical Kit ?
【 Answer submission 】
This is a result filling question , You just need to work out the results and submit them . The result of this problem is a
integer , Only fill in this integer when submitting the answer , Fill in the extra content will not be able to score .

<> 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 Represents a number of times k The cycle of . The scope of loop control is expressed by indentation ,
The number of consecutive indents from the next line that are greater than the line ( The front blank is longer ) The content contained 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
In this clip, the A = A + 4 Where is the line A = A + 8 All the lines are in the first line
In two cycles .
REPEAT 6: Where is the line A = A + 7 All the lines are here REPEAT 5: In circulation .
A = A + 5 What is the actual total number of cycles 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 work out the results and submit them . The result of this problem is a
integer , Only fill in this integer when submitting the answer , Fill in the extra content will not be able to score .

<> test questions E: matrix

Total score of this question :15 branch
【 Problem description 】
hold 1 ~2020 Put in 2 * 1010 In my matrix . The one on the right is larger than the one on the left in the same row , same
The bottom of the column is larger than the top . How many options are there ?
The answer is big , You just need to give the number of solutions divided by 2020 The remainder of .
【 Answer submission 】
This is a result filling question , You just need to work out the results and submit them . The result of this problem is a
integer , Only fill in this integer when submitting the answer , Fill in the extra content will not be able to score .

<> test questions F: Integer division 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 of the sequence is n, Each number after is divided by the previous one 2, Please lose
Find the items with positive values in the 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 , Express the answer .
【 sample input 】
20
【 sample output 】
20 10 5 2 1
【 Scale and convention of evaluation case 】
about 80% Evaluation case of ,1 < n <= 10^9.
For all evaluation cases ,1 <n <=10^18.
#include <iostream> using namespace std; int main() { long long n = 0; // I want to go through all the examples
cin>> n ; while(n > 0) { cout << n << " "; n /= 2; } 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's a lot of continuity and repetition . Xiao Ming thought of a way to translate the alphabet
It's shorter : Write several consecutive identical letters as letters + The form of the number of occurrences .
for example , successive 5 individual a, Namely aaaaa, Xiao Ming can be abbreviated as a5( It may also be abbreviated as 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 be more than one in a row 9 Write the same characters in short form .
Now we 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 convention of evaluation case 】
For all evaluation cases , The string consists of uppercase and lowercase letters and numbers , Length not exceeding
100.
Please note that the original string length may exceed 100.
#include <iostream> using namespace std; bool judge(char s) { if(s > 'A' && s <
'Z') { return true; } else if(s > 'a' && s < 'z') { return true; } else { return
false; } } int main() { string s1 = ""; cin >> s1; string s2 = ""; char s; for(
int i = 0; i < s1.size(); ++i) { if(judge(s1[i])) { s2 += s1[i]; s = s1[i]; }
else { int size = s1[i] - '0'; for(int i = 0; i < size - 1 ; ++i) { s2 += s; } }
} cout << s2 << endl; return 0; }
<> test questions H: Go square

time limit : 1.0s Memory limit : 256.0MB Total score of this question :20 branch
【 Problem description 】
There are some two-dimensional lattices in the plane .
The number of these points is like that of a two-dimensional array , From top to bottom, it is the third 1 To n that 's ok ,
From left to right is the second 1 To m Column , Each point can be represented by a row number and a column number .
Now there's a man standing in the second place 1 Line number 1 Column , We have to go to the third place n Line number m Column . It can only be 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 , Express the answer .
【 sample input 】
3 4
【 sample output 】
2
【 sample input 】
6 6
test questions H: Go square 9
The 11th Blue Bridge Cup software provincial competition C/C++ university B group
【 sample output 】
0
【 Scale and convention of evaluation case 】
For all evaluation cases ,1 n 30, 1 m 30.
try
#include <iostream> using namespace std; int num = 0; void solve(int n , int m
, int key1 , int key2) { if(n % 2== 0 && m % 2 == 0 ) { num = 0; return; } if(
key1== n && key2 == m) { num++; return ; } if((key1 % 2 == 0) && (key2 % 2 == 0)
) { return ; } if(key1 > n || key2 > m) { return ; } solve(n , m , key1 + 1 ,
key2); solve(n , m , key1, key2 + 1); } int main() { int n = 0 , m = 0; cin >> n
; cin >> m; solve(n , m , 1 , 1); cout << num << endl; 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), And then Ai and Aj One before and one after to make a new integer . for example 12 and 345 can
Put together 12345 or 34512. Attention exchange Ai and Aj The order of is always regarded as 2 A spelling , even if
yes Ai = Aj Time .
Please calculate how many kinds of spelling meet the requirements of the whole number K Multiple of .
【 Input format 】
The first line contains 2 An integer n and K.
The second line contains n An integer A1; A2; ; An.
【 Output format 】
An integer represents the answer .
【 sample input 】
4 2
1 2 3 4
【 sample output 】
6
【 Scale and convention of evaluation case 】
about 30% Evaluation case of ,1 n 1000, 1 K 20, 1 Ai 104.
For all evaluation cases ,1 n 105,1 K 105,1 Ai 109.
test questions I: Integer splicing 11
#include <iostream> #include <vector> using namespace std; int main() { int n =
0; int K = 0; int nums = 0; cin >> n; cin >> K; vector<int> v(n,0); for(int i =
0; i < n ; ++i) { int key = 0; cin >> key; v[i] = key; } string s1 = ""; for(int
i=0 ; i < n ; ++i) { for(int j = 0; j < n ; j++) { if(i != j) { s1 = to_string(
i) + to_string(j); if(stoi(s1) % K == 0) { nums++; } } } } cout << nums << endl;
return 0; }
<> 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 it up n Computers , They are called nodes , Used for sending, receiving and storing data .
At the beginning , All nodes are independent , There is no connection .
Xiao Ming can connect the two nodes through the network cable , After connecting, the two nodes can communicate with each other
It's over . If there is a cable connection between two nodes , It's called adjacency .
Xiao Ming sometimes tests the network at that time , He will send a message at a certain node , The message will be sent
To each adjacent node , After that, these nodes will forward to their neighboring 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 the information stored in each node .
【 Input format 】
The first line of input contains two integers n;m, Represents the number of nodes and the number of 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 a And nodes b Connected by cable . When a = b
Time , Indicates that a self ring is connected , There is no real impact on the network .
If the operation is 2 p t, Represents a node in the p Send a message with the size of t Information on .
【 Output format 】
Output one line , contain n An integer , Adjacent integers are separated by a space , In turn, it means to proceed
After the above operation, the node 1 To node n Size of information stored on .
test questions J: network analysis 12
The 11th Blue Bridge Cup software provincial competition C/C++ university B group
【 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 convention of evaluation case 】
about 30% Evaluation case of ,1 n 20,1 m 100.
about 50% Evaluation case of ,1 n 100,1 m 1000.
about 70% Evaluation case of ,1 n 1000,1 m 10000.
For all evaluation cases ,1 n 10000,1 m 100000,1 t 100.
try
#include <iostream> #include <queue> using namespace std; int main() { int n =
0; int m = 0; cin >> n; cin >> m; int ar[n + 1][n + 1] = {0}; //bool arJudge[n
+ 1][n + 1] = {0}; bool arJudge[n + 1] = {0}; vector<int> v(n,0); for(int i =0 ;
i<= n ; ++i) { for(int j =0 ; j <= n ; ++j) { ar[i][j] = 0; //arJudge[i][j] =
0; } //cout << endl; } int a = 0 , b = 0 , c = 0; for(int i = 0 ; i < m ; ++i) {
cin>> a; cin >> b; cin >> c; if(a == 1) { if(ar[b][c] == 0) { ar[b][c] = 1; }
if(ar[c][b] == 0) { ar[c][b] = 1; } } if(a == 2) { queue<int> que; que.push(b);
/* int key = b; for(int i = 1 ; i <= n; ++i) { if(ar[b][i] != 0) { que.push(i);
} }*/ while(!que.empty()) { int size = que.size(); for(int i = 0 ; i < size; ++i
) { int temp = que.front(); que.pop(); if(arJudge[temp] == 0) { v[temp - 1] += c
; arJudge[temp] = 1; } for(int j = 1; j <= n ; ++j) { if(ar[temp][j] != 0 && j
!= temp && arJudge[j] == 0 ) { que.push(j); } } } } } for(int i = 0 ; i <=n ; ++
i) { arJudge[i] = 0; } } /* for(int i = 1 ; i <= n ; ++i) { for(int j = 1 ; j
<= n ; ++j) { v[i - 1] += ar[j][i]; } }*/ for(int i = 1 ; i <= n ; ++i) { for(
int j = 1 ; j <= n ;++j) { cout << ar[i][j] <<" "; } cout << endl; } for(int i =
0 ; i< n; ++i) { cout << v[i] << " "; } cout <<endl; return 0; }

Technology
©2019-2020 Toolsou All rights reserved,
Hikvision - Embedded software written test questions C Language application 0 The length of array in memory and structure is 0 In depth analysis data structure --- The preorder of binary tree , Middle order , Subsequent traversal How to do it ipad Transfer of medium and super large files to computer elementui Shuttle box el-transfer Display list content text too long 2019 The 10th Blue Bridge Cup C/C++ A Summary after the National Games ( Beijing Tourism summary )unity Shooting games , Implementation of first person camera python of numpy Module detailed explanation and application case Study notes 【STM32】 Digital steering gear Horizontal and vertical linkage pan tilt Vue Used in Element Open for the first time el-dialog Solution for not getting element