CF869B.The Eternal Immortality

普及-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Even if the world is full of counterfeits, I still regard it as wonderful.

Pile up herbs and incense, and arise again from the flames and ashes of its predecessor — as is known to many, the phoenix does it like this.

The phoenix has a rather long lifespan, and reincarnates itself once every a! years. Here a! denotes the factorial of integer a, that is, a! = 1 × 2 × ... × a. Specifically, 0! = 1.

Koyomi doesn't care much about this, but before he gets into another mess with oddities, he is interested in the number of times the phoenix will reincarnate in a timespan of b! years, that is, . Note that when b ≥ a this value is always integer.

As the answer can be quite large, it would be enough for Koyomi just to know the last digit of the answer in decimal representation. And you're here to provide Koyomi with this knowledge.

即使世间充斥着赝品,我依然视其为奇妙。

堆砌香草与熏香,于前生的烈焰与灰烬中再度重生——众所周知,凤凰正是如此。

凤凰的寿命相当漫长,每 a!a! 年便重生一次。此处 a!a! 表示整数 aa 的阶乘,即 a!=1×2×⋯×aa! = 1 \times 2 \times \dots \times a。特别地,0!=10! = 1。

小夜虽不太在意此事,但在他再次陷入种种怪异事件之前,他很好奇凤凰在 b!b! 年的时间跨度内将重生多少次,即 b!a!\frac{b!}{a!}。注意:当 b≥ab \geq a 时,该值恒为整数。

由于答案可能非常大,小夜只需知道该答案在十进制表示下的末位数字即可。而你,正要为此提供帮助。

输入格式

The first and only line of input contains two space-separated integers a and b (0 ≤ a ≤ b ≤ 1018).

输入仅有一行,包含两个以空格分隔的整数 aa 和 bb(0 ≤ a ≤ b ≤ 10180 ≤ a ≤ b ≤ 10^{18})。

输出格式

Output one line containing a single decimal digit — the last digit of the value that interests Koyomi.

输出一行,包含一个十进制数字——即 Koyomi 所关心的值的最后一位数字。

输入输出样例

  • 输入#1

    2 4

    输出#1

    2
  • 输入#2

    0 10

    输出#2

    0
  • 输入#3

    107 109

    输出#3

    2

说明/提示

In the first example, the last digit of is 2;

In the second example, the last digit of is 0;

In the third example, the last digit of is 2.

在第一个例子中, 的末位数字是 2;

在第二个例子中, 的末位数字是 0;

在第三个例子中, 的末位数字是 2。

输入解题思路,AI测评打分。不知道怎么写?

首页