問題一覧 > 通常問題

No.502 Just Compute the Factorial

レベル : / AI推定難易度 : 1175 / 実行時間制限 : 1ケース 1.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 197
作問者 : kimiyuki / テスター : Pulmn
お気に入りにしたユーザー ProblemId : 1504 / 自分の提出
問題文最終更新日: 2026-06-25 02:22:21
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 160 (順位表) の他の問題:

Problem Statement

You are given an integer $n$. Find $X = n! \bmod (10^9+7)$.

Input

n

The input satisfies $0 \le n \le 10^{18}$.

Output

X

Print a newline at the end.

Sample

Sample 1
Input
5
Output
120

$5! = 120$.

Sample 2
Input
0
Output
1
Sample 3
Input
100
Output
437918130

$100! = 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000$.

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