NC14323. Factorial
描述
输入描述
There are multiple test cases. The first line is an positive integer T indicating the number of test cases.(0<T<=1000)
For each test case:
A positive integer N(0<=N<=20)
输出描述
For each test case, output one line.
示例1
输入:
3 1 2 3
输出:
1 2 6
pypy3(pypy3.6.1) 解法, 执行用时: 37ms, 内存消耗: 18596K, 提交时间: 2021-04-22 17:04:31
def solve(): n=int(input()) re=1 for i in range(1,n+1): re*=i print(re) for _ in range(int(input())): solve()
Python3 解法, 执行用时: 26ms, 内存消耗: 4472K, 提交时间: 2021-12-14 00:50:03
import math [print(math.factorial(int(input()))) for i in range(int(input()))]