#P16209. [ECUSTPC 2025] 眼见为实

    ID: 18224 远端评测题 1000ms 1024MiB 尝试: 0 已通过: 0 显示难度入门 上传者: 标签>2025Special Judge枚举高校校赛

[ECUSTPC 2025] 眼见为实

Problem Description

Maddy and Baddy are having a battle of minds.
Baddy has a hidden number aa in mind, and aa satisfies the following rules:

  • aa is a natural number.
  • la<l+6l \le a < l + 6.
  • The remainder when aa is divided by 22 is m2m_2, and the remainder when aa is divided by 33 is m3m_3.

Now Maddy knows l,m2,m3l, m_2, m_3. Please help her find a possible value of aa that Baddy might be thinking of. If no possible answer exists, report that there is no solution.

Input Format

One line contains 33 integers l,m2,m3l, m_2, m_3 (0l100,0m2<2,0m3<30 \le l \le 100, 0 \le m_2 < 2, 0 \le m_3 < 3), representing the range of Baddy’s number, the remainder when divided by 22, and the remainder when divided by 33, respectively.

Output Format

If a valid answer exists, output one integer aa in one line, representing the number Baddy is thinking of. If there are multiple valid answers, you may output any one of them.
If no possible answer exists, output one integer 1-1 in one line.

0 1 2
5
63 1 1
67

Hint

Explanation for Sample 1

Check the above properties one by one:

  • 55 is a natural number.
  • 05<0+60 \le 5 < 0 + 6.
  • The remainder when 55 is divided by 22 is 11, and the remainder when 55 is divided by 33 is 22.

Therefore, 55 satisfies the conditions of the number Baddy is thinking of, and it is a possible value.

Hint

00 is a natural number.

Translated by ChatGPT 5