#P8751. [蓝桥杯 2021 省 B2] 填空问题
[蓝桥杯 2021 省 B2] 填空问题
Problem Description
This problem consists of five fill-in-the-blank tasks, A to E. You only need to compute the result and submit it. Each result is an integer. When submitting the answer, write only that integer; any extra content will not receive points.
Task A: Modulo
Problem Description
In languages such as $\mathrm{C} / \mathrm{C}++/ \mathrm{Java} / \mathrm{Python}$, % denotes the modulo operation. What is the value of 2021%20?
Answer Submission
This is a fill-in-the-blank problem. You only need to compute the result and submit it. The result is an integer. When submitting, write only that integer; any extra content will not receive points.
Task B: Double Factorial
Problem Description
The double factorial of a positive integer is defined as the product of all positive integers not exceeding it that have the same parity (odd/even) as it. The double factorial of is denoted by .
For example:
.
.
$11!!=11 \times 9 \times 7 \times 5 \times 3 \times 1=10395$.
What are the last digits (in decimal) of ?
Note: $2021!!=2021 \times 2019 \times \cdots \times 5 \times 3 \times 1$.
Hint: It is recommended to solve this using computer programming.
Answer Submission
This is a fill-in-the-blank problem. You only need to compute the result and submit it. The result is an integer. When submitting, write only that integer; any extra content will not receive points.
Task C: Lattice Points
Problem Description
If both coordinates of a point are integers, i.e., and , then the point is called a lattice point.
If both coordinates of a point are positive, i.e., and , then the point lies in the first quadrant.
Among lattice points in the first quadrant, how many points satisfy that the product of the two coordinates is at most , i.e., ?
Hint: It is recommended to solve this using computer programming.
Answer Submission
This is a fill-in-the-blank problem. You only need to compute the result and submit it. The result is an integer. When submitting, write only that integer; any extra content will not receive points.
Task D: Integer Decomposition
Problem Description
Decomposing into a sum of two positive integers has two methods: and . Note that different orders count as different methods.
Decomposing into a sum of three positive integers has methods: , , , , , .
How many methods are there to decompose into a sum of five positive integers?
Answer Submission
This is a fill-in-the-blank problem. You only need to compute the result and submit it. The result is an integer. When submitting, write only that integer; any extra content will not receive points.
Task E: City-States
Problem Description
The country of Xiaolan is a water kingdom with city-states, numbered from to . Between every pair of city-states, there is a bridge directly connecting them.
To celebrate a traditional festival, the government of Xiaolan plans to decorate some of the bridges.
For two city-states numbered and , the cost to decorate the bridge between them is computed as follows: find all digit positions (in base 10) where and have different digits, and sum the digits at those positions from both numbers.
For example, for city-states and , the thousands, hundreds, and ones digits are all different. Summing the digits at these positions gives . Note that has no thousands digit, so its thousands digit is treated as .
To save money, the government plans to decorate only bridges, and it must be guaranteed that from any city-state to any other city-state, one can travel using only decorated bridges.
What is the minimum total cost needed to complete the decoration?
Hint: It is recommended to solve this using computer programming.
Answer Submission
This is a fill-in-the-blank problem. You only need to compute the result and submit it. The result is an integer. When submitting, write only that integer; any extra content will not receive points.
Input Format
Input a single uppercase letter indicating which task it is.
Output Format
Output the answer corresponding to the given task letter.
Hint
Answer template for reference.
#include<iostream>
using namespace std;
int main() {
string ans [] = {
"The answer of task A", // Replace inside quotes with the answer to task A
"The answer of task B", // Replace inside quotes with the answer to task B
"The answer of task C", // Replace inside quotes with the answer to task C
"The answer of task D", // Replace inside quotes with the answer to task D
"The answer of task E", // Replace inside quotes with the answer to task E
};
char T;
cin >> T;
cout << ans[T - 'A'] << endl;
return 0;
}
Translated by ChatGPT 5