a040: Factorial Number 階乘數
標籤 : Mathematics 數學
通過比率 : 100% (28 人 / 28 人 ) (非即時)
評分方式 :
Tolerant

最近更新 : 2019-03-05 16:37

內容

Write a program that prompts the user to input a number 'n', and then print the i-th factorial number defined as follows:
F(0) = 1, F(1) = 1, F(2) = 1x2, and F( n ) =1x2x3x…x(n-2)x(n-1)xn

撰寫一個程式,令使用者輸入數字'n',然後輸出定義如下的第i個階乘數:
F(0) = 1, F(1) = 1, F(2) = 1x2, and F( n ) =1x2x3x…x(n-2)x(n-1)xn

輸入說明

The input consists of M cases. The first line of the input contains only one positive integer M, followed by M cases. Each case consists of exactly one line with one integer n, 0 ≤ n ≤ 12.

輸入由M個案例組成。 輸入的第一行只包含一個正整數M,後跟M個案例。 每種情況恰好包含一行,其中一個整數n,0≤n≤12。

輸出說明

For each case, print exactly one line containing only one integer: the i-th factorial number.

對於每種案例,輸出只包含一個整數的一行:第i個階乘數。

範例輸入
3
1
3
5
範例輸出
1
6
120
測資資訊 :
記憶體限制 : 64 MB
隱藏 測資點#0 (50%): 1.0s , <1K
隱藏 測資點#1 (50%): 1.0s , <1K
提示 :
標籤:
Mathematics 數學
出處:
線上協同學習平臺 - ITSA 教育部資通訊軟體創新人才推升計畫 [編輯 :
zero_jason (zero_jason(MANAGER))
]


編號 身分 題目 主題 人氣 發表日期
沒有發現任何「解題報告」