#abc273a. A - A Recursive Function

A - A Recursive Function

Score : 100100 points

问题描述

一个函数 f(x)f(x) 定义在非负整数 xx 上,满足以下条件:

  • f(0)=1f(0) = 1
  • 对于所有正整数 kk,有 f(k)=k×f(k1)f(k) = k \times f(k-1)

f(N)f(N) 的值。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

A function f(x)f(x) defined for non-negative integer xx satisfies the following conditions:

  • f(0)=1f(0) = 1;
  • f(k)=k×f(k1)f(k) = k \times f(k-1) for all positive integers kk.

Find f(N)f(N).

Constraints

  • NN is an integer such that 0N100 \le N \le 10.

Input

The input is given from Standard Input in the following format:

NN

Output

Print the answer as an integer.

Sample Input 1

2

Sample Output 1

2

We have $f(2) = 2 \times f(1) = 2 \times 1 \times f(0) = 2 \times 1 \times 1 = 2$.

Sample Input 2

3

Sample Output 2

6

We have f(3)=3×f(2)=3×2=6f(3) = 3 \times f(2) = 3 \times 2 = 6.

Sample Input 3

0

Sample Output 3

1

Sample Input 4

10

Sample Output 4

3628800

update @ 2024/3/10 11:29:27

}