[해커랭크] Extra Long Factorials
https://www.hackerrank.com/challenges/extra-long-factorials/problem?isFullScreen=true
Extra Long Factorials | HackerRank
Calculate a very large factorial that doesn't fit in the conventional numeric data types.
www.hackerrank.com
The factorial of the integer , written , is defined as:
Calculate and print the factorial of a given integer.
For example, if , we calculate and get .
Function Description
Complete the extraLongFactorials function in the editor below. It should print the result and return.
extraLongFactorials has the following parameter(s):
- n: an integer
Note: Factorials of can't be stored even in a long long variable. Big integers must be used for such calculations. Languages like Java, Python, Ruby etc. can handle big integers, but we need to write additional code in C/C++ to handle huge values.
We recommend solving this challenge using BigIntegers.
Input Format
Input consists of a single integer
Constraints
Output Format
Print the factorial of .
Sample Input
Sample Output
Explanation
풀이
BigInteger를 사용하라고 친절히 문제에 적혀져있는 그대로 구현
'알고리즘 단련장 > 해커랭크' 카테고리의 다른 글
[해커랭크] Utopian Tree (0) | 2025.08.14 |
---|---|
[해커랭크] Designer PDF Viewer (1) | 2025.08.14 |
[해커랭크] The Hurdle Race (0) | 2025.08.14 |
[해커랭크] Climbing the Leaderboard (2) | 2025.08.14 |
[해커랭크] Picking Numbers (0) | 2025.08.12 |