問題一覧 > 教育的問題

No.2269 The Last Digit of the Integer Part of eN!

レベル : / AI推定難易度 : 1100 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 56
作問者 : 👑 p-adic / テスター : 👑 qand
お気に入りにしたユーザー ProblemId : 9305 / 自分の提出
問題文最終更新日: 2023-04-14 22:58:24
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 384 (順位表) の他の問題:

Problem Statement

Consider the following problem:

An integer $N$ is given as input.

Find the last $1$ digit of $\lfloor e (N!) \rfloor$. (Hereafter, this value is called the answer to this problem.)

Here, $e$ is the base of the natural logarithm, and for a real number $x$, $\lfloor x \rfloor$ denotes the greatest integer not exceeding $x$.

 

A positive integer $T$ is given at the beginning of the input. Then answer $T$ such problems.

Input

The input is given from standard input in $1 + T$ lines in the following format:

  • Line $1$ contains $T$.
  • For each positive integer $t$ not exceeding $T$, line $1 + t$ contains the input $N$ for the $t$-th problem.

Constraints

The input satisfies the following constraints:

  • $T$ is an integer satisfying $1 \leq T \leq 10^5$
  • The input $N$ for each problem is an integer satisfying $0 \leq N \leq 10^{18}$

Output

For each positive integer $t$ not exceeding $T$, print the answer to the $t$-th problem on line $t$.

Print a newline at the end.

Sample

Sample 1
Input
1
1
Output
2

The greatest integer not exceeding $e (N!) = e = 2.718 \cdots$ is $2$, and its last $1$ digit is $2$.

Sample 2
Input
1
2
Output
5

The greatest integer not exceeding $e (N!) = 2e = 5.436 \cdots$ is $5$, and its last $1$ digit is $5$.

Sample 3
Input
2
4
3
Output
5
6

For the $1$-st problem, the input is $N = 4$. The greatest integer not exceeding $e (N!) = 24e = 65.238 \cdots$ is $65$, and its last $1$ digit is $5$.

For the $2$-nd problem, the input is $N = 3$. The greatest integer not exceeding $e (N!) = 6e = 16.309 \cdots$ is $16$, and its last $1$ digit is $6$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。