본문 바로가기

알고리즘, PS, 문제풀기등10

백준 수 이어쓰기 2 - 이분 탐색 https://velog.io/@embeddedjune/%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98-%EB%B0%B1%EC%A4%80-%EC%9D%B4%EC%A7%84%ED%83%90%EC%83%89-%ED%8C%8C%EB%9D%BC%EB%A9%94%ED%8A%B8%EB%A6%AD-%EC%84%9C%EC%B9%98-1790-%EC%88%98-%EC%9D%B4%EC%96%B4-%EC%93%B0%EA%B8%B0-2 #if 1 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #define ll long long #define ull unsigned long long using name.. 2023. 2. 25.
책 복사하기 1, 2(정올) / 백준 Copying books(3487) - 이분 탐색 책 복사하기1 https://www.acmicpc.net/problem/3487 3487번: Copying Books The input consists of N cases. The first line of the input contains only positive integer N. Then follow the cases. Each case consists of exactly two lines. At the first line, there are two integers m and k, 1 ≤ k ≤ m ≤ 500. At the second li www.acmicpc.net https://zoosso.tistory.com/645 [Jungol] 정올 1156 책 복사하기2 출처: http://www.jun.. 2023. 2. 25.
숫자구슬(정올) / 백준 숫자구슬(2613) - 이분탐색 숫자구슬 https://www.acmicpc.net/problem/2613 2613번: 숫자구슬 첫째 줄에 구슬의 개수 N과 그룹의 수 M이 주어진다. 둘째 줄에는 각 구슬이 적혀진 숫자가 왼쪽부터 차례로 주어진다. N은 300 이하의 자연수, M은 N이하의 자연수이며, 구슬에 적혀진 숫자는 100 www.acmicpc.net #include using namespace std; int N, M; int arr[300]; bool isPossible(int mid) { int sum = 0, groupCnt = 1; for (int i = 0; i mid){ sum = arr[i]; groupCnt++; } } return groupCnt.. 2023. 2. 7.
[230131] 구현 문제 prefix_sum const 구간의 합 구하기(1D) https://beta.jungol.co.kr/problem/3135 한번 입력된 값은 변화하지 않는다는 특징 덕분에 prefix sum이 가능한 것이다. https://www.acmicpc.net/problem/11659 11659번: 구간 합 구하기 4 첫째 줄에 수의 개수 N과 합을 구해야 하는 횟수 M이 주어진다. 둘째 줄에는 N개의 수가 주어진다. 수는 1,000보다 작거나 같은 자연수이다. 셋째 줄부터 M개의 줄에는 합을 구해야 하는 구간 i와 j www.acmicpc.net #if 1 #define _CRT_SECURE_NO_WARNINGS #include #define MAX_N 1000000 #define LL long long using namespa.. 2023. 1. 31.