[PYTHON] 백준 10872 - 팩토리얼

이또삐(이민혁)·2023년 4월 13일

CODINGTEST

목록 보기
25/96
post-thumbnail

성능 요약

메모리: 113112 KB, 시간: 120 ms

분류

수학, 구현, 조합론

문제 설명

0보다 크거나 같은 정수 N이 주어진다. 이때, N!을 출력하는 프로그램을 작성하시오.

입력

첫째 줄에 정수 N(0 ≤ N ≤ 12)이 주어진다.

출력

첫째 줄에 N!을 출력한다.

#https://www.acmicpc.net/problem/10872
#팩토리얼
#10872

import sys
input = sys.stdin.readline

n = int(input())
result = 0

def fact(n):
    if n == 0 or n == 1 :
        result = 1
    else:
        result = n * fact(n-1)
    return result

# def fact(n):
#     if n == 0 or n == 1 :
#         return 1
#     else:
#         return n * fact(n-1)
#     # return result

# print(fact(10))

print(fact(n))
profile
해보자! 게임 클라 개발자!

0개의 댓글