QOJ.ac

QOJ

时间限制: 1 s 内存限制: 512 MB 总分: 100

#3435. 三位数

统计

Per 对阶乘非常着迷。他喜欢计算阶乘、估算阶乘、阅读关于阶乘的资料、绘制阶乘、梦见阶乘,甚至为了阶乘与人争论。他甚至把 $12! = 479\,001\,600$ 的值纹在了背上。

他很久以前就注意到阶乘末尾有很多零,并编写了一个程序来计算末尾零的个数。例如,$12!$ 以 $600$ 结尾,因此它有 $2$ 个末尾零。现在他想更进一步,看看末尾零之前的 $3$ 位数字。对于 $12!$ 的情况,末尾零之前的最后 $3$ 位数字是 $016$。

摄影:Sjoerd van Oosten

给定一个整数 $n$,求 $n!$ 末尾零之前的最后 $3$ 位数字。如果不足 $3$ 位,则输出所有这些数字。

输入格式

输入包含一行,为一个整数 $n$ ($1 \le n \le 10\,000\,000$)。

输出格式

输出一行,为 $n!$ 末尾零之前的 $3$ 位数字。如果不足 $3$ 位,则输出所有这些数字。

样例

输入格式 1

5

输出格式 1

12

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.