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 |
Tags
- 구현
- XR Interaction Toolkit
- 정렬
- BFS
- c++
- 그래프
- Unreal Engine 5
- 누적 합
- 트리
- Team Fortress 2
- 문자열
- 알고리즘
- 재귀
- DFS
- 백트래킹
- 다익스트라
- 그리디 알고리즘
- 수학
- 유니티
- 백준
- VR
- 투 포인터
- 브루트포스
- 자료구조
- 스택
- 유니온 파인드
- ue5
- 우선순위 큐
- 다이나믹 프로그래밍
- 시뮬레이션
Archives
- Today
- Total
1일1알
백준 17213번 과일 서리 C++ 본문
https://www.acmicpc.net/problem/17213
17213번: 과일 서리
민건이네 과일 농장은 N가지 종류의 과일을 재배하는 중이다. 평소 민건이에게 앙심을 품고 있던 지환이는 민건이를 골탕 먹이기 위하여 민건이네 과일 농장에서 과일들을 훔치기로 다짐했다.
www.acmicpc.net
중복조합
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <set>
#include <map>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <limits.h>
using namespace std;
using int64 = long long;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int64 n, m;
cin >> n >> m;
m -= n;
int64 x = 1;
int64 y = 1;
int64 xStart = n + m - 1;
int64 yStart = min(n - 1, m);
for (int i = 0; i < yStart; i++) {
x *= xStart - i;
y *= yStart - i;
}
cout << x / y;
}
'알고리즘' 카테고리의 다른 글
백준 11578번 팀원 모집 C++ (0) | 2023.03.30 |
---|---|
백준 1461번 도서관 C++ (0) | 2023.03.26 |
백준 16397번 탈출 C++ (0) | 2023.03.23 |
백준 18353번 병사 배치하기 C++ (0) | 2023.03.22 |
백준 1965번 상자넣기 C++ (0) | 2023.03.21 |