Translation Notice
This article was machine-translated using DeepSeek-R1.
- Original Version: Authored in Chinese by myself
- Accuracy Advisory: Potential discrepancies may exist between translations
- Precedence: The Chinese text shall prevail in case of ambiguity
- Feedback: Technical suggestions regarding translation quality are welcomed
A - Century
Problem Statement
In which century does the year $N$ fall?
A century consists of 100 consecutive years. For example, the 1st century is years [1,100], the 2nd century is years [101,200], etc.
$1\le N\le 3000$
Input Format
$N$
Output Format
Print the answer as an integer.
Sample Cases
$N$ | Output |
---|---|
$2021$ | $21$ |
$200$ | $2$ |
Analysis
We can derive that year $N$ belongs to the $\lceil \frac N {100}\rceil$ century.
Code
|
|
B - 200th ABC-200
Problem Statement
Perform the following operations $K$ times on integer $N$:
- If $N$ is a multiple of 200, divide it by 200.
- Otherwise, append 200 to $N$ (e.g., 123 becomes 123200).
$1\le N\le 10^5$
$1\le K\le 20$
Input Format
$N~K$
Output Format
Print the final $N$.
Sample Cases
$N$ | $K$ | Output |
---|---|---|
$2021$ | $4$ | $50531$ |
$40000$ | $2$ | $1$ |
$8691$ | $20$ | $84875488281$ |
Analysis
We simulate the process while proving the result fits in long long
:
- Appending 200 to any $N$ makes it divisible by 200 (ends with two zeros).
- After appending, dividing by 200 reduces digit count. Thus, $N$ remains strictly below $2^{63}$.
Code
|
|
C - Ringo’s Favorite Numbers 2
Problem Statement
Given sequence $A=(A_1,A_2,\dots,A_N)$, find all pairs $(i,j)$ satisfying:
- $1\le i < j\le N$
- $|A_i-A_j|$ is a multiple of 200.
$2\le N\le 2\times 10^5$
$1\le A_i\le 10^9$
Output Format
$N$
$A_1~A_2~\dots~A_N$
Sample Cases
$A$ | Output |
---|---|
$(123,223,123,523,200,2000)$ | $4$ |
$(1,2,3,4,5)$ | $0$ |
$(199,100,200,400,300,500,600,200)$ | $9$ |
Analysis
We use modulo 200 buckets to count pairs in $\mathcal O(n)$ time:
- Elements in the same remainder bucket form valid pairs.
- For each element, add current bucket count to the answer before updating the bucket.
Note: The answer must be of type long long
!
Code
|
|
D - Happy Birthday! 2
Problem Statement
Given sequence $A=(A_1,A_2,\dots,A_N)$, find two distinct subsequences $B$ and $C$ (different indices, not necessarily contiguous) such that $\sum B\equiv \sum C\pmod{200}$.
$2\le N\le 200$
$1\le A_i\le 10^9$
Input Format
$N$
$A_1~A_2~\dots~A_N$
Output
If no solution exists, print No
.
Otherwise, output:
$\text{Yes}$
$x~B'_1~B'_2~\dots~B'_x$
$y~C'_1~C'_2~\dots~C'_y$
Sample Cases
See AtCoder for details.
Analysis
When $N\ge 8$, pigeonhole principle guarantees a solution (255 subsets mod 200). For $N<8$, brute-force all subsets.
Code
|
|
E - Patisserie ABC 2
Problem Statement
There are $N^3$ triples $(i,j,k)$ ($1\le i,j,k\le N$), ordered by:
- Ascending $i+j+k$
- For equal sums, ascending $i$, then $j$
Find the $K$-th triple.
$1\le N\le 10^6$
$1\le K\le N^3$
Input Format
$N~K$
Output Format
Print the $K$-th triple separated by spaces.
Sample Cases
$N$ | $K$ | Output |
---|---|---|
$2$ | $5$ | $1 2 2$ |
$1000000$ | $1000000000000000000$ | $1000000 1000000 1000000$ |
$9$ | $47$ | $3 1 4$ |
Analysis
Iterate possible sums $s$ and compute valid triples count using inclusion-exclusion:
- Number of solutions to $i+j+k=s$ in $[1,N]$ is $f(s) - 3f(s-N) + 3f(s-2N)$ where $f(n) = \binom{n-1}{2}$ for $n\ge3$.
Code
|
|