#P9420. [蓝桥杯 2023 国 B] 子 2023 / 双子数

    ID: 10577 远端评测题 1000ms 256MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>动态规划 DP2023提交答案素数判断,质数,筛法蓝桥杯国赛

[蓝桥杯 2023 国 B] 子 2023 / 双子数

Problem Description

A Sub 2023

Xiao Lan wrote all integers from 11 to 20232023 on the blackboard one after another, obtaining a digit sequence:

S=1234567891011121320222023S = 12345678910111213\cdots 20222023

Xiao Lan wants to know how many subsequences in SS are exactly equal to 20232023.

As a hint, the following are 33 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 22, 00, 22, and 33, the order is incorrect:

$$1[\textbf2]345678910111[\textbf2]131415161718192[\textbf0]21222[\textbf3] \cdots$$

B Twin Numbers

If a positive integer xx can be written as p2×q2p^2 \times q^2, where pp and qq are prime numbers and pqp \neq q, then xx is a “twin number”. Please compute how many “twin numbers” are in the interval [2333,23333333333333][2333, 23333333333333].

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