이분탐색

DEV/PS

[BOJ/14746] Closest Pair, c++

🔗 링크 https://www.acmicpc.net/problem/14746 14746번: Closest Pair Your program is to read from standard input. The input consists of four lines. The first line contains two integers, n (1 ≤ n ≤ 500,000) and m (1 ≤ m ≤ 500,000), where n is the number of points in set P and m is the number of points in set Q. In th www.acmicpc.net 🤯 한줄 후기 수식써서 어려워 보이게 하기 🤷 문제 👩‍💻 풀이 ICPC 예선 대비 팀 스터디를 시작했다. 2017 대전 인..

DEV/PS

[2512] 예산, c++

[2512] 예산 https://www.acmicpc.net/problem/2512 2512번: 예산 첫째 줄에는 지방의 수를 의미하는 정수 N이 주어진다. N은 3 이상 10,000 이하이다. 다음 줄에는 각 지방의 예산요청을 표현하는 N개의 정수가 빈칸을 사이에 두고 주어진다. 이 값들은 모두 1 이상 www.acmicpc.net 한줄 후기 : 내 예산은 마이너스 #include #include using namespace std; int arr[10000]; int n, m; bool check(int x){ int cnt=0; for(int i=0; i x){ cnt+=x; } else{ cnt+=arr[i]; } } if(cnt

DEV/PS

[1920] 수 찾기

한줄후기 : 마음이 편해진다. https://www.acmicpc.net/problem/1920 1920번: 수 찾기 첫째 줄에 자연수 N(1≤N≤100,000)이 주어진다. 다음 줄에는 N개의 정수 A[1], A[2], …, A[N]이 주어진다. 다음 줄에는 M(1≤M≤100,000)이 주어진다. 다음 줄에는 M개의 수들이 주어지는데, 이 수들이 A안에 존재하는지 알아내면 된다. 모든 정수들의 범위는 int 로 한다. www.acmicpc.net 아주 쉬운 이분탐색 문제 #include #include using namespace std; int main() { int n; int arr[100001] = { 0 }; scanf("%d", &n); for (int i = 0; i < n; i++) { ..

jobchae
'이분탐색' 태그의 글 목록