전체 글
11659번: 구간 합 구하기 4첫째 줄에 수의 개수 N과 합을 구해야 하는 횟수 M이 주어진다. 둘째 줄에는 N개의 수가 주어진다. 수는 1,000보다 작거나 같은 자연수이다. 셋째 줄부터 M개의 줄에는 합을 구해야 하는 구간 i와 jwww.acmicpc.net📌 접근 방법구간합이란 누적합으로 구한다고 생각하면 편함!배열에 값을 앞에서부터 누적시켜 저장한 후 해당 구간(i, j)의 합을 구하기 위해서는 ~j 까지의 누적합이 담긴 j번째 값에서 i-1을 빼주면 됨! 예를 들면 arr 배열에 1, 2, 4, 3, 6의 값이 있는데 2~4 구간의 합을 구하고 싶음!배열에 누적합으로 1, 3, 7, 10, 16을 저장(인덱스는 1부터 시작한다)4번째 값에서 2-1 번째 값을 빼주면 됨! ✅ PASS CODE..
⚡️ Scanner 평소 Scanner를 통해 입출력을 진행하였는데, 복잡한 알고리즘을 풀면 시간초과가 발생하는 경우가 많았다. 시간 초과를 해결하기 위해 알아보다가 BufferedReader를 사용한다는 것을 알고 정리해보려한다 📌 Buffer 임시 저장 공간이라고 생각할 수 있다. 어떤 데이터가 전송 될 때, 일시적으로 저장되는 메모리 영역이다. BufferedReader / BufferedWriter는 버퍼를 사용하여 읽기와 쓰기를 진행하는 함수이다. 버퍼를 사용하지 않고 입력하면 입력하자마자 바로 프로그램에 전달된다. 버퍼를 사용해서 입력하면 입력할 때마다 한 문자씩 버퍼로 전달한다. ➡️ 버퍼가 가득 차거나 혹은 개행 문자가 나타나면 버퍼의 내용을 한 번에 프로그램에 전달한다. 입력받자마자 바로..
매우 악명이 높은 애플로그인을 ..... 구현해보았습니다...... 제가 이해한 애플로그인의 방법은 1. 프론트로부터 authorization_code를 넘겨받고 2. 해당 코드로 유저정보 및 access token을 발급받고 3. DB에 없는 회원이라면 회원가입을 시킨 후 로그인하고, 기존회원이라면 로그인을 시킨 후 4. 토큰을 반환하는 식으로... 구현하였습니다 spring: security: oauth2: client: registration: apple: clientId: [Bundle ID] clientSecret: /home/ec2-user/app/[keyname.p8] redirect-uri: https://[domain.com]/login/oauth2/code/apple authorizat..
1546번: 평균 첫째 줄에 시험 본 과목의 개수 N이 주어진다. 이 값은 1000보다 작거나 같다. 둘째 줄에 세준이의 현재 성적이 주어진다. 이 값은 100보다 작거나 같은 음이 아닌 정수이고, 적어도 하나의 값은 0보 www.acmicpc.net ✅ PASS CODE import java.util.Scanner; public class Main { public static void main(String [] args) { Scanner sc = new Scanner(System.in); int M = sc.nextInt(); int max = 0; int[] arr = new int[1001]; double sum = 0; for (int i = 0; i < M; i++) { arr[i] = sc...