Algorithm(C++)/이진탐색1 [BOJ - 2343] 기타 레슨(C++) 문제 접근 방법 이진탐색으로 최적의 블루레이값을 탐색, count 변수를 설정해 M과 비교 기존 코드#include #include using namespace std;int N, M;vector v;bool isPossible(int x) { int count = 1, tmp = 0; for (int i: v) { tmp += i; if (tmp > x) { count++; tmp = i; } if (count > M) return false; } return true;}int main() { cin >> N >> M; v.resize(N); int max_length .. 2025. 2. 9. 이전 1 다음