Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- coding
- DP
- 북리뷰
- OS
- Stack
- 너비우선탐색
- 컴공
- 컴퓨터공학과
- vector
- 브루트포스
- 문제풀이
- Operating System
- 코테
- 구현
- 코딩
- 오에스
- 개발
- 오퍼레이팅시스템
- cs
- 정석
- 그래프
- 정석학술정보관
- Computer science
- 알고리즘
- 컴공과
- 백준
- bfs
- c++
- 스택
- 자료구조
Archives
- Today
- Total
Little Jay
[C++] 백준 11050번 이항 계수1 본문
팩토리얼을 구하는 내장 함수가 있을줄 알았는데 찾아보니
그냥 시간 낭비하는게 싫어서 바로 코드를 짜버렸다.
#include <iostream>
#include <cmath>
using namespace std;
int factorial(int num)
{
int result = 1;
for (int i = 1; i <= num; ++i)
{
result = result * i;
}
return result;
}
int main() {
int n, k;
cin >> n >> k;
int answer = factorial(n) / (factorial(k) * factorial(n - k));
cout << answer << "\n";
return 0;
}'알고리즘 > BOJ' 카테고리의 다른 글
| [C++] 백준 1531번 투명 (0) | 2021.03.23 |
|---|---|
| [C++] 백준 1292번 쉽게 푸는 문제 (0) | 2021.03.23 |
| [C++] 백준 10773번 제로 (0) | 2021.03.21 |
| [C++] 백준 1152번 단어의 개수 (0) | 2021.03.21 |
| [C++] 백준 10809번 알파벳 찾기 (0) | 2021.03.15 |
Comments