#P9309. [EGOI 2021] Number of Zeros / 零的个数

    ID: 10441 远端评测题 1000ms 256MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>数学2021O2优化EGOI(欧洲/女生)

[EGOI 2021] Number of Zeros / 零的个数

Background

Day 1 Problem A.

Translated from EGOI2021 zeros.

Problem Description

Santa Claus is preparing for Christmas 20212021. He wants to buy a positive integer number of gifts so that they can be evenly distributed among all well-behaved children. However, he does not know the exact number of well-behaved children; he only knows that the number is between aa and bb. He wants to buy the smallest positive integer number of gifts such that it can be evenly divided among any x{a,a+1,,b}x \in \{a, a+1, \ldots, b\} children.

He has already computed this (possibly very large) number of gifts, but he is not sure whether his computation is correct, so he wants you to do some basic correctness checks. Can you tell him how many trailing zeros the answer has?

Input Format

One line containing two integers a,ba, b.

Output Format

One line containing one integer, the number of trailing zeros of the answer.

1 6
1
10 11
1

Hint

Explanation for Sample 11

If there may be between 11 and 66 well-behaved children, Santa Claus needs at least 6060 gifts (this is the smallest positive integer divisible by 1,2,3,4,5,61,2,3,4,5,6), and 6060 has one trailing zero.


Explanation for Sample 22

If there may be 1010 or 1111 well-behaved children, Santa Claus will buy 110110 gifts.


Constraints

For all testdata, 1ab10181 \le a \le b \le 10^{18}.

  • Subtask 1 (66 points): b16b \le 16.
  • Subtask 2 (77 points): b40b \le 40.
  • Subtask 3 (99 points): a=1a = 1, b200b \le 200.
  • Subtask 4 (1212 points): ba106b-a \le 10^6.
  • Subtask 5 (1717 points): a=1a = 1.
  • Subtask 6 (4949 points): no additional constraints.

Translated by ChatGPT 5