백준 15651 N과M(3) (백트래킹) #define _CRT_SECURE_NO_WARNINGS #include using namespace std; #define pb push_back #define ss stable_sort #define ll long long int n, m; int arr[10]; //넉넉하게 10개짜리 배열 void dfs(int x) { //백트래킹 if (x == m) { //백트래킹이 어느 조건에 도달했을때 for (int i = 0; i 백준 풀이 C++ 2022.09.22
백준 15650 N과 M(2) C++ (백트레킹) #define _CRT_SECURE_NO_WARNINGS #include using namespace std; #define pb push_back #define ss stable_sort #define ll long long int n, m; int arr[10]; //넉넉하게 10개짜리 배열 bool visited[10]; //방문 여부 void dfs(int x,int y) { //백트래킹 if (x == m) { //백트래킹이 어느 조건에 도달했을때 for (int i = 0; i m; // 입력받기 dfs(0,1); //0부터 시작 arr는 인덱스가 0부터이기 때문 // n,m과 상관 x return 0; } 백준 풀이 C++ 2022.09.22
백준 15649 C++ (백트래킹) #define _CRT_SECURE_NO_WARNINGS #include using namespace std; #define pb push_back #define ss stable_sort #define ll long long int n, m; int arr[10]; //넉넉하게 10개짜리 배열 bool visited[10]; //방문 여부 void dfs(int x) { //백트래킹 if (x == m) { //백트래킹이 어느 조건에 도달했을때 for (int i = 0; i m; // 입력받기 dfs(0); //0부터 시작 arr는 인덱스가 0부터이기 때문 // n,m과 상관 x return 0; } 백준 풀이 C++ 2022.09.22
백준 1427 c++ 거꾸로 sort #include using namespace std; #define pb push_back #define ss stable_sort int main() { cin.tie(0)->sync_with_stdio(0); string s; cin >>s; sort(s.begin(), s.end(), greater()); cout 백준 풀이 C++ 2022.09.19
백준 2581 C++ 소수찾기 #include using namespace std; bool flag = true; bool sosu(int n) { if (n > a >> b; for (int i = a; i 백준 풀이 C++ 2022.09.17
백준 2609 c++ 유클리드 호제법 #include using namespace std; int gcd(int x, int y) { int z = x % y; while (z != 0) { x = y; y = z; z = x % y; } return y; } int lcm(int x, int y) { return (x * y) / gcd(x, y); } int main() { cin.tie(0)->sync_with_stdio(0); int a, b; cin >> a >> b; cout 카테고리 없음 2022.09.17
백준 5635번 c++ vector sort #include using namespace std; struct stu { string n; int d, m, y; }; bool com(const struct stu& x, const struct stu& y) { if (x.y sync_with_stdio(0); int k; cin >> .. 백준 풀이 C++ 2022.09.17
백준 1822 C++ 차집합 #include using namespace std; int main() { cin.tie(0)->sync_with_stdio(0); int a, b; cin >> a >> b; set s; for (int i = 0, x; i > x; s.emplace(x); } for (int i = 0, x; i > x; s.erase(x); } cout 백준 풀이 C++ 2022.09.16
백준 2910번 c++ map활용 #include using namespace std; int main() { cin.tie(0)->sync_with_stdio(0); int n, c; cin >> n >> c; int arr[1005]; for (int i = 0; i > arr[i]; } map mp, fr; for (int i = 0; i pair(mp[y], -fr[y]); }); for (int i = 0; i < n;i++) { cout 백준 풀이 C++ 2022.09.16
백준 1978 C++ (소수) (sqrt) #include #include #include #include #include #include #include using namespace std; int main() { int n; int cnt = 0; cin >> n; vector v(n); for (int i = 0; i > new_num; v[i] = new_num; if (v[i] == 2 or v[i] == 3) { cnt++; } } for (int i = 0; i < n; i++) { for (int j = 2; j 백준 풀이 C++ 2022.09.04