template<class T>
const T& min (const T& a, const T& b)
template<class T>
const T& max (const T& a, const T& b)
min(1,2); //1반환
min(2,2); //2반환
min('b', 'd'); //'b' 반환
min(345.678, 123.456); //123.456 반환
max(1,2); //2 반환
max(2,2); //2 반환
max('b', 'd'); //'d' 반환
max(345.678, 123.456); //345.678 반환
순열이란 서로 다른 n개의 원소에서 r개를 뽑아 한 줄로 세우는 경우의 수
// default
bool next_permutation (BidirectionalIterator first, BidirectionalIterator last);
// custom
bool next_permutation (BidirectionalIterator first, BidirectionalIterator last, Compare comp);
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
vector<int> v{ 1, 2, 3};
sort(v.begin(), v.end());
do {
for (auto it = v.begin(); it != v.end(); ++it)
cout << *it << ' ';
cout << endl;
} while (next_permutation(v.begin(), v.end()));
}
void combination(string src, string dst, int depth){//dst의 길이가 depth라면 저장, 아니라면 다음 문자열 combination
if(dst.size()==depth) course_cnt[dst]+=1;
else{
for(int i=0;i<src.size();i++) combination(src.substr(i+1),dst+src[i],depth);
}
}