#P8727. [蓝桥杯 2020 国 A] 填空问题
[蓝桥杯 2020 国 A] 填空问题
Problem Description
Task A: Number of Composite Numbers
Problem Description
A number is called a composite number if it has divisors other than and itself. For example, are not composite numbers, while are composite numbers.
How many composite numbers are there from to ?
Answer Submission
This is a fill-in-the-blank question. You only need to compute the result and submit it. The result is an integer. When submitting, only fill in this integer; any extra content will cause you to receive no score.
Task B: Days Containing
Problem Description
Xiao Lan especially likes . This year is AD , so he is very happy because he can see on the calendar every day.
If the calendar displays only year, month, and day, from AD year month day to AD year month day, how many days have a date that contains on the calendar? That is, on how many days does the digit appear in the digits of the year, month, or day?
Answer Submission
This is a fill-in-the-blank question. You only need to compute the result and submit it. The result is an integer. When submitting, only fill in this integer; any extra content will cause you to receive no score.
Task C: Essentially Increasing Subsequences
Problem Description
Xiao Lan especially likes monotonically increasing things.
In a string, if you pick some characters and keep their relative order as in the original string, and the resulting sequence is strictly increasing, then it is called a strictly increasing subsequence of this string.
For example, in the string lanqiao, if you take the characters and , then forms a strictly increasing subsequence. Other such subsequences include Inq, i, ano, and so on.
Xiao Lan found that some subsequences have different positions but the same character sequence. For example, taking the second character and the last character yields , and taking the last two characters also yields ao. Xiao Lan thinks they are not essentially different.
For a string, Xiao Lan wants to know how many essentially different increasing subsequences it has.
For example, for the string lanqiao, there are essentially different increasing subsequences. They are l, a, n, q, i, o, ln, an, lq, aq, nq, ai, lo, ao, no, io, lnq, anq.
For the following string (a total of lowercase English letters, shown in four lines): (If you copy the following text into a text file, please be sure to check that the copied content is exactly the same as in the document. There is a file inc.txt in the task directory, whose content is the same as the text below.)
tocyjkdzcieoiodfpbgcncsrjbhmugdnojjddhllnofawllbhf
iadgdcdjstemphmnjihecoapdjjrprrqnhgccevdarufmliqij
gihhfgdcmxvicfauachlifhafpdccfseflcdgjncadfclvfmad
vrnaaahahndsikzssoywakgnfjjaihtniptwoulxbaeqkqhewl
How many essentially different increasing subsequences are there?
Answer Submission
This is a fill-in-the-blank question. You only need to compute the result and submit it. The result is an integer. When submitting, only fill in this integer; any extra content will cause you to receive no score.
Task D: So Near Yet So Far
Problem Description
A Peano curve is a curve on the plane.
The figure below shows the order- Peano curve. It starts from the lower-left corner, passes through every cell in a grid, and finally reaches the upper-right corner.

Assume each cell has side length . In the figure above, some adjacent cells (4-neighbor adjacency) are also adjacent on the Peano curve, so their distance along the curve is . Some adjacent cells are not adjacent on the curve, so their distance along the curve is greater than .
For example, the cells above and below the center cell are adjacent to it on the Peano curve, so the distance is , while the left and right cells are not adjacent to it on the curve, so the distance is .
The figure below shows the order- Peano curve. It passes through every cell in a grid. It is obtained by replacing each cell of the order- curve with an order- curve.

The figure below shows the order- Peano curve. It passes through every cell in a grid. It is obtained by replacing each cell of the order- curve with an order- curve.

A Peano curve always starts from the lower-left corner and finally reaches the upper-right corner.
Xiao Lan is curious about the adjacency relationship of neighboring cells on the Peano curve. He wants to know the sum of distances along the curve for all pairs of adjacent cells.
For example, for the order- Peano curve, the distance sum is : there are pairs of adjacent cells with distance , pairs with distance , and pairs with distance .
For another example, for the order- Peano curve, the distance sum is .
Please compute the distance sum for the order- Peano curve.
Hint: The answer does not exceed .
Answer Submission
This is a fill-in-the-blank question. You only need to compute the result and submit it. The result is an integer. When submitting, only fill in this integer; any extra content will cause you to receive no score.
Task E: Toy Snake
Problem Description
Xiao Lan has a toy snake with a total of segments, labeled with numbers to . Each segment is a square. Two adjacent segments can be in a straight line or form a degree angle.
Xiao Lan also has a grid box to store the toy snake. The cells of the box are labeled with the letters to , a total of letters.
Xiao Lan can fold the toy snake and place it into the box. He found that there are many ways to put the toy snake in.
The figure below shows two ways:

Please help Xiao Lan compute how many different ways there are in total. If in two ways, there exists some segment of the toy snake that is placed in a different cell of the box, then the two ways are considered different.
Answer Submission
This is a fill-in-the-blank question. You only need to compute the result and submit it. The result is an integer. When submitting, only fill in this integer; any extra content will cause you to receive no score.
Input Format
Input a capital letter, indicating which task it is.
Output Format
According to the input task letter, output the answer for the corresponding task.
Hint
Answer template for reference.
#include<iostream>
using namespace std;
int main() {
string ans [] = {
"The answer of task A", // Replace the content in double quotes with the answer for Task A
"The answer of task B", // Replace the content in double quotes with the answer for Task B
"The answer of task C", // Replace the content in double quotes with the answer for Task C
"The answer of task D", // Replace the content in double quotes with the answer for Task D
"The answer of task E", // Replace the content in double quotes with the answer for Task E
};
char T;
cin >> T;
cout << ans[T - 'A'] << endl;
return 0;
}
Translated by ChatGPT 5