일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 컴공과
- 컴공
- c++
- vector
- Operating System
- cs
- 개발
- 구현
- Stack
- 너비우선탐색
- 정석
- DP
- 알고리즘
- 스택
- 자료구조
- 코테
- coding
- 북리뷰
- 컴퓨터공학과
- Computer science
- 오퍼레이팅시스템
- 브루트포스
- 정석학술정보관
- 백준
- 오에스
- bfs
- 그래프
- 문제풀이
- 코딩
- OS
- Today
- Total
목록전체 글 (304)
Little Jay
팩토리얼을 구하는 내장 함수가 있을줄 알았는데 찾아보니 그냥 시간 낭비하는게 싫어서 바로 코드를 짜버렸다. #include #include using namespace std; int factorial(int num) { int result = 1; for (int i = 1; i > n >> k; int answer = factorial(n) / (factorial(k) * factorial(n - k)); cout
vector 메소드 중에서 pop_back을 사용하는 문제. 아마 이 메소드를 사용하면 알아서 마지막 원소를 삭제해줘서 간단하게 풀 수 있지 않을까 생각한다. #include #include #include using namespace std; int main() { int k; cin >> k; vector list; for (int i = 0; i > a; if (a == 0) { list.pop_back(); } else { list.push_back(a); } } int sum = 0; for (int i = 0; i < list.size(); i++) { sum += list[i]; } cout
#include #include using namespace std; int main() { string s; getline(cin, s); int count = 0; if (s.empty()) { cout
string의 find 메소드를 사용하면 간단하게 풀 수 있다. #include #include using namespace std; int main() { string s; cin >> s; string comp = "abcdefghijklmnopqrstuvwxyz"; int arr[25]{ -1 }; for (int i = 0; i < comp.length(); i++) { cout
to_string 메소드를 생각하면 쉽게 풀 수 있었다. #include #include using namespace std; int main() { long a, b, c; cin >> a >> b >> c; long sum = a * b * c; string num; num = to_string(sum); int len = num.length(); int numArr[10]{ 0 }; for (int i = 0; i < len; i++) { switch (num[i]) { case '0': numArr[0]++; break; case '1': numArr[1]++; break; case '2': numArr[2]++; break; case '3': numArr[3]++; break; case '4':..
단순히 sort 만 쓰면 당연하게도 틀리는 문 이 문제때문에 처음으로 stable_sort 를 써보았다. stable_sort가 정리되어있는 www.cplusplus.com/reference/algorithm/stable_sort/ stable_sort - C++ Reference function template std::stable_sort template void stable_sort ( RandomAccessIterator first, RandomAccessIterator last ); template void stable_sort ( RandomAccessIterator first, RandomAccessIterator last, Compare comp ); Sort elements preserv..
#include using namespace std; int main() { int testCase, height, width, number; cin >> testCase; for (int i = 0; i > height >> width >> number; int y, x; y = number % height; x = number / height; if (y > 0) { x++; } else { y = height; } cout
#include #include using namespace std; int main() { int x, y, w, h; cin >> x >> y >> w >> h; int newWidth = w - x; int newHeight = h - y; int arr[4]; arr[0] = x; arr[1] = y; arr[2] = newWidth; arr[3] = newHeight; int min = 1000; for (int i = 0; i < 4; i++) { if (arr[i] < min) { min = arr[i]; } } cout
#include #include #include using namespace std; int main() { ios::sync_with_stdio(false); int testCase, a; cin >> testCase; vector list; for (int i = 0; i > a; list.push_back(a); } sort(list.begin(), list.end()); for (int i = 0; i < testCase; i++) { cout