flick
close
프로필 사진

flick

github: @hy-0n

  • 분류 전체보기 (26)
    • 코딩 알고리즘 (5)
      • C \ C++ (5)
    • web (18)
      • web (11)
      • 웹 해킹 (7)
    • ect. (2)
      • project (2)
  • 홈
  • 태그
  • 방명록
알고리즘 - 이분탐색 - c++

알고리즘 - 이분탐색 - c++

이 코드를 쉽게 이해하기 위해서 그림을 그려보았다 이 그림만 봐도 충분히 이해가 될것이라고 생각하지만 더욱 확실한 이해를 위해 주석으로 예제를 넣어보았다 #include #include using namespace std;int a[100000];int main() { int n; cin >> n; // 10 10개를 입혁한다는뜻 for (int i = 0; i > a[i]; // 6 3 2 10 10 10 -10 -10 7 3 배열이다 sort(a, a + n); // -10 -10 2 3 3 6 7 10 10 10 정렬을 해준것이다 int m; cin >> m; ..

  • format_list_bulleted 코딩 알고리즘/C \ C++
  • · 2025. 6. 23.

알고리즘 - 그리디

1931 - 회의실 배정#include #include using namespace std;int st[1000000];int ed[1000000];// 종료 시간 기준 정렬 but 같으면 시작 시간 기준 정렬bool compare(int i, int j) { if (ed[i] == ed[j]) { return st[i] > n; int list[1000000]; for (int i = 0; i > st[i] >> ed[i]; list[i] = i; } // 회의 리스트를 종료 시간 기준으로 정렬 sort(list, list + n, compare); int count = 0; int last = 0; // **겹치지 않는 작업**..

  • format_list_bulleted 코딩 알고리즘/C \ C++
  • · 2025. 6. 18.

알고리즘 백준 문제 풀이 - 5차시

1260번 - DFS와 BFS 이번 문제는 점 과 선 ( 구조 ) 가 주어지고 dfs 와 bfs 로 탐색해서 순서를 출력하는 문제입니다#include #include #include #include using namespace std;int n, m, v;int edge[1001][1001] = {0};int visited[1001] = {0};void dfs() { stack s; s.push(v); while (!s.empty()) { int t = s.top(); s.pop(); if (visited[t]) continue; printf("%d ", t); visited[t] = 1; for (int i = ..

  • format_list_bulleted 코딩 알고리즘/C \ C++
  • · 2025. 6. 9.

알고리즘 백준 문제 풀이 - 4차시

9012번 - 괄호#include #include #include using namespace std;int main() { char str[100]; int n; cin >> n; //입력 받는다 for (int h = 0; h q; //큐 선언 cin >> str; //((()))()()()()())(((()()( 입력 받기 for (int i = 0; str[i] != '\0'; i++) { q.push(str[i]); //큐에 넣어주기 } int num = q.size(); bool no = false; for (int i = 0; i 0) { ..

  • format_list_bulleted 코딩 알고리즘/C \ C++
  • · 2025. 6. 2.

백준 알고리즘 문제 풀이 - 2차시

알고리즘 수업 - 버블 정렬 1 - 23968번#include int main() { int n; int num; int count = 0; scanf("%d %d", &n, &num); //입력을 받는다 int arr[n]; for (int i = 0; i arr[j + 1]) { int temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; count++; //교환횟수를 증가해준다 if (count == num) { //만약 num번째면 종료 pr..

  • format_list_bulleted 코딩 알고리즘/C \ C++
  • · 2025. 5. 26.
  • navigate_before
  • 1
  • navigate_next
공지사항
전체 카테고리
  • 분류 전체보기 (26)
    • 코딩 알고리즘 (5)
      • C \ C++ (5)
    • web (18)
      • web (11)
      • 웹 해킹 (7)
    • ect. (2)
      • project (2)
인기 글
전체 방문자
오늘
어제
Copyright © 이게뭐에요? 모든 권리 보유.
SKIN: Copyright © 쭈미로운 생활 All rights reserved. Designed by JJuum.
and Current skin "dev-roo" is modified by Jin.

티스토리툴바