Skip to content

Commit

Permalink
Update base_code.java
Browse files Browse the repository at this point in the history
  • Loading branch information
rhs0266 authored Nov 3, 2022
1 parent 71f16e7 commit c4f69d5
Showing 1 changed file with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class Main {
static FastReader scan = new FastReader();
static StringBuilder sb = new StringBuilder();

static int N, Sum;
static int N;
static int[] A;

static void input() {
Expand All @@ -14,23 +14,26 @@ static void input() {
for (int i = 1; i <= N; i++) {
A[i] = scan.nextInt();
}
Sum = scan.nextInt();
}

static boolean bin_search(int[] A, int L, int R, int X) {
// A[L ... R] 에서 X 가 존재하면 true, 없으면 false 를 return 하는 함수
static int lower_bound(int[] A, int L, int R, int X) {
// TODO
}

static void pro() {
// A 에 대해 이분 탐색을 할 예정이니까, 정렬을 미리 해주자.
static int upper_bound(int[] A, int L, int R, int X) {
// TODO
}

int ans = 0;
for (int i = 1; i <= N - 1; i++) {
// A[i] 를 선택했다. 즉 우린 Sum - A[i] 가 배열에 있는 지 확인해야 한다.
if (/* TODO */) ans++;
static void pro() {
int M = scan.nextInt();
Arrays.sort(A, 1, N + 1);
for (int i = 1; i <= M; i++) {
int X = scan.nextInt();
int upper = upper_bound(A, 1, N, X);
int lower = lower_bound(A, 1, N, X);
sb.append(upper - lower).append(' ');
}
System.out.println(ans);
System.out.println(sb);
}

public static void main(String[] args) {
Expand Down Expand Up @@ -84,4 +87,4 @@ String nextLine() {
return str;
}
}
}
}

0 comments on commit c4f69d5

Please sign in to comment.