P9427 [Lанqiao Cup 2023 National B] Forming Digits
Description
Xiao Lan wants to use $N$ digits $2$ and $M$ digits $3$ to form an integer with $N + M$ digits. Please compute the largest multiple of $2023$ that Xiao Lan can form.
Input Format
Two integers $N$ and $M$.
Output Format
An integer with $N + M$ digits, representing the answer. If it is impossible to form a multiple of $2023$, output $-1$.
Explanation/Hint
### Constraints
- For $20\%$ of the testdata, $1 \le N, M \le 12$.
- For $40\%$ of the testdata, $1 \le N, M \le 100$.
- For $60\%$ of the testdata, $1 \le N, M \le 10000$.
- For $100\%$ of the testdata, $1 \le N, M \le 1000000$.
Final Round of the 14th Lanqiao Cup Software Contest, C/C++ College Group B, Problem I.
Translated by ChatGPT 5