0! = 1
팩토리얼 구하는 문제.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
/** | |
* https://www.acmicpc.net/problem/10872 | |
* BOJ 백준온라인져지 10872 팩토리얼 풀이 | |
*/ | |
int main(){ | |
unsigned long long result = 1; | |
int N; | |
scanf("%d", &N); | |
while(N--) result *= N+1; | |
printf("%lld", result); | |
} |
'IT > 알고리즘' 카테고리의 다른 글
BOJ 백준온라인져지 2960 에라토스테네스의 체 풀이 (0) | 2017.12.06 |
---|---|
BOJ 백준온라인져지 2490 윷놀이 풀이 (0) | 2017.12.05 |
BOJ 백준온라인져지 1037 약수 풀이 (0) | 2017.12.05 |
BOJ 백준온라인져지 2163 초콜릿 자르기 풀이 (0) | 2017.12.05 |
BOJ 백준온라인져지 2293 동전 1 풀이 (0) | 2017.12.04 |