[백준] 1475번 방 번호 import java.util.HashMap; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); String number = kb.next(); HashMap map = new HashMap(); for(int i=0; i 공부기록/백준 2023.12.17
[백준] 5800번 성적 통계 import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); StringBuilder sb = new StringBuilder(); int k = kb.nextInt(); for(int i=0; i 공부기록/백준 2023.12.17
[백준] 2023번 수들의 합 2 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int n = kb.nextInt(); int m = kb.nextInt(); int[] prefixSum = new int[n]; prefixSum[0] = kb.nextInt(); for (int i = 1; i < n; i++) { prefixSum[i] = prefixSum[i - 1] + kb.nextInt(); } int count = 0; int lt = 0, rt = 0; while (lt < n && rt < n) { int sum; if (lt == 0) { sum =.. 공부기록/백준 2023.12.15
[백준] 3273번 두 수의 합 import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int n = kb.nextInt(); int[] arr = new int[n]; for(int i=0; i 공부기록/백준 2023.12.13
[백준] 2164번 카드2 import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int n = kb.nextInt(); Queue queue = new LinkedList(); for(int i=1; i1) { queue.poll(); queue.add(queue.poll()); } System.out.println(queue.poll()); } } 공부기록/백준 2023.12.13
[백준] 1157번 단어 공부 import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); String sentence = kb.next().toUpperCase(); HashMap map = new HashMap(); List list = new ArrayList(); int max = 0; for(char c: sentence.toCharArray()) { map.put(c, map.getOrDef.. 공부기록/백준 2023.12.13
[백준] 1253번 좋다 [방법1 - HashMap 이용] import java.util.HashMap; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int N = kb.nextInt(); int[] arr = new int[N]; for (int i = 0; i < N; i++) { arr[i] = kb.nextInt(); } int count = 0; for (int i = 0; i < N; i++) { HashMap map = new HashMap(); for (int j = 0; j < N; j++) { if (i == j) continue; in.. 공부기록/백준 2023.12.13
[백준] 1940번 주몽 import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int n = kb.nextInt(); int m = kb.nextInt(); int[] arr = new int[n]; for(int i=0; i 공부기록/백준 2023.12.11
[백준] 10986번 나머지 합 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int n = kb.nextInt(); int m = kb.nextInt(); long[] sum = new long[m]; // 나머지 별 개수를 저장할 배열 long answer = 0; long prefixSum = 0; sum[0] = 1; // 초기값 설정 for (int i = 0; i < n; i++) { prefixSum = (prefixSum + kb.nextLong()) % m; answer += sum[(int) prefixSum]; // 이전까지의 누적합을 더함 s.. 공부기록/백준 2023.12.11
[백준] 25206번 너의 평점은 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); String scoreList[] = {"A+", "A0", "B+", "B0", "C+", "C0", "D+", "D0", "F", "P"}; double scoreList2[] = {4.5, 4.0, 3.5, 3.0, 2.5, 2.0, 1.5, 1.0, 0.0, 0.0}; double total = 0; double creditTotal = 0; for(int i=0; i 카테고리 없음 2023.12.05