#P9420. [蓝桥杯 2023 国 B] 子 2023 / 双子数
[蓝桥杯 2023 国 B] 子 2023 / 双子数
Problem Description
A Sub 2023
Xiao Lan wrote all integers from to on the blackboard one after another, obtaining a digit sequence:
Xiao Lan wants to know how many subsequences in are exactly equal to .
As a hint, the following are subsequences that satisfy the requirement (the digits marked in square brackets are the digits included in the subsequence):
$$1[\textbf2]34567891[\textbf0]111[\textbf2]1[\textbf3]14151617181920212223 \cdots$$$$1[\textbf2]34567891[\textbf0]111[\textbf2]131415161718192021222[\textbf3] \cdots$$$$1[\textbf2]34567891[\textbf0]111213141516171819[\textbf2]021222[\textbf3] \cdots$$Note that the following does not satisfy the requirement. Although it contains the four digits , , , and , the order is incorrect:
$$1[\textbf2]345678910111[\textbf2]131415161718192[\textbf0]21222[\textbf3] \cdots$$B Twin Numbers
If a positive integer can be written as , where and are prime numbers and , then is a “twin number”. Please compute how many “twin numbers” are in the interval .
Input Format
Input one uppercase letter, indicating which problem it is.
Output Format
According to the input problem label, output the answer of the corresponding problem.
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 Problem A.
"The answer of task B", // Replace the content in double quotes with the answer for Problem B.
};
char T;
cin >> T;
cout << ans[T - 'A'] << endl;
return 0;
}
The 14th Lanqiao Cup Software Competition Final, C/C++ College Group B, Problems A and B.
Translated by ChatGPT 5