On a LanqiaoCup problem

Правка en4, от Aveiro_quanyue, 2023-06-12 09:53:02

You are given $$$n$$$ '2' and $$$m$$$ '3'. Try to concatenate these $$$n+m$$$ characters into a largest base-10 number $$$d$$$ such that $$$2023 \mid d$$$. If you cannot get such $$$d$$$, print $$$-1$$$.

Example $$$1$$$:

Input: $$$n = 2, m = 8$$$.

Output: $$$d = 2233333333$$$. Please note that $$$2233333333 = 2023 \times 1103971$$$, and it is the largest.

Example $$$2$$$:

Input: $$$n = 2, m = 2$$$.

Output: $$$-1$$$ (no solution).

Constraints: $$$1 \leq n,m \leq 1e6$$$. Time $$$1s$$$, memory $$$256MB$$$.

Теги number theory

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский Aveiro_quanyue 2023-06-12 09:53:02 92
en3 Английский Aveiro_quanyue 2023-06-12 09:51:35 0 (published)
en2 Английский Aveiro_quanyue 2023-06-12 09:51:24 4 Tiny change: 'given $n$ '2' and $m$ '' -> 'given $n$ `'2'` and $m$ '' (saved to drafts)
en1 Английский Aveiro_quanyue 2023-06-12 09:51:08 402 Initial revision (published)