#P8760. Multi-Part Calculation Problem
Multi-Part Calculation Problem
Multi-Part Calculation Problem
This problem consists of five sub-problems. The input is a single uppercase letter from the set {A, B, C, D, E}, indicating which sub-problem to solve. The sub-problems are described below:
Subproblem A: Integer Range
We use 8‐bit binary (one byte) to represent a nonnegative integer. The minimum value is 0. In general the maximum representable value is given by the formula \[ 2^8-1=255, \] so the answer is 255.
Subproblem B: Bandwidth
Blue’s network has a bandwidth of \(200\,\mathrm{Mbps}\). Since there are 8 bits in a byte, the maximum theoretical download per second in megabytes is calculated as \[ 200\div8=25\,\mathrm{MB}, \] so the answer is 25.
Subproblem C: Pure Primes
A positive integer is prime if it has no divisors other than 1 and itself. A prime whose every digit (in base-10) is also a prime digit (i.e. one of 2, 3, 5, 7) is called a pure prime. For example, 2, 3, 5, 7, 23, 37 are pure primes, whereas 11, 13, 17, 19 are not. Count how many pure primes exist in the interval [1, 20210605].
Subproblem D: Perfect Date
A date is called a perfect date if the sum of all the digits of its year, month and day (when written as normal integers without leading zeros) is a perfect square. For example, for June 5, 2021 the digit sum is \[ 2+0+2+1+6+5=16=4^2, \] so it is a perfect date. Count how many perfect dates there are between January 1, 2001 and December 31, 2021.
Subproblem E: Minimum Weight
For a rooted binary tree \(T\), define the weight \(W(T)\) recursively as follows. The weight of an empty subtree is 0. If a node \(v\) has left subtree \(L\) and right subtree \(R\) containing \(C(L)\) and \(C(R)\) nodes respectively, then its weight is defined by \[ W(v)=1+2W(L)+3W(R)+\bigl(C(L)\bigr)^2\,C(R). \] The weight of the tree is the weight of its root. Given that the tree has exactly 2021 nodes, compute the minimum possible weight of such a tree.
Note: Each subproblem is a result‐output (fill in the blank) problem. When you submit your answer you should output only the integer result corresponding to the chosen subproblem.
inputFormat
The input consists of a single line containing one uppercase letter from the set {A, B, C, D, E}, indicating which subproblem to solve.
outputFormat
Output a single integer – the answer for the corresponding subproblem.
sample
A
255