Editorial - 2023 Children's Day Mini Contest
C2301 - Hugo's Dinner
Do what the question says.
C2302 - Biology Exam
For each number in the input, check if the $i$-th number is not equal to $i$.
C2303 - Heron's Formula
Calculate $s = \frac{a + b + c}{2}$, then apply the formula.
You are expected to use sqrt
from <cmath>
,
and relevant functions from <iomanip>
.
Possible mistake: forgetting to cast either of the operands into a double before doing division.
In C++, when x
is an odd integer, x/2
will be truncated!
C2304 - Count Digits
For positive integers $N$, we can repeatedly divide $N$ by $10$ until it reaches $0$. The number of divisions is the answer.
However, this method fails for $N = 0$. The number $0$ has one digit, which you should handle separately.
C2305 - Quasiperfect Numbers (Bonus)
Subtask 1 (70%)
For each integer from $1$ to $M$, check if it fits the criteria for being a quasiperfect number.
Subtask 2 (30%)
We have not discovered any quasiperfect numbers yet. Mathematicians have shown that if quasiperfect numbers exist, they must be larger than $10^{35}$.