[백준] 2231번: 분해합 - JAVA
·
Algorithm/백준
[작성일: 2023. 10. 12]  https://www.acmicpc.net/problem/2231  풀이import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); boolean check = true; for (int i = 0; i 0) { sum += num % 10; num /= 10; } if (sum + i == n) { ..
[백준] 2798번: 블랙잭 - JAVA
·
Algorithm/백준
[작성일: 2023. 10. 11] https://www.acmicpc.net/problem/2798  풀이import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int sum = 0; int[] card = new int[n]; for (int i = 0; i sum) { sum = tempSum; } ..
[백준] 24313번: 알고리즘 수업 - 점근적 표기 1 - JAVA
·
Algorithm/백준
[작성일: 2023. 10. 10] https://www.acmicpc.net/problem/24313  풀이import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a1 = sc.nextInt(); int a0 = sc.nextInt(); int c = sc.nextInt(); int n0 = sc.nextInt(); boolean bigO = true; for (int i = n0; i c * i) { bigO =..
[백준] 24262번~24265번: 알고리즘 수업 - 알고리즘의 수행 시간 - JAVA
·
Algorithm/백준
[작성일: 2023. 10. 09] https://www.acmicpc.net/problem/24262 풀이import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println(1); System.out.println(0); }} MenOfPassion 알고리즘은 입력의 크기 n에 관계없이 return A[i]; (코드 1)는 딱 한 번만 수행된다.코드1의 수행 횟수는 1번이며 코드1의 수행 횟수를 다항식으로 나타냈을 때 최고차항의 차수는 O(상수항, O(1))이다.이 코드는..
[백준] 14215번: 세 막대 - JAVA
·
Algorithm/백준
[작성일: 2023. 10. 08]  https://www.acmicpc.net/problem/14215  풀이import java.util.Arrays;import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] arr = new int[3]; for (int i = 0; i  이 문제를 풀 때 고려해야 할 점이 있다. 삼각형의 제일 큰 변의 길이는 나머지 두 변의 길이의 합보다 짧아야 한다.이 조건에 만족한다면 세 변의 길이를 더한 값을 출력하면 된다.이 조건에 만족하지 않으면 가장 긴 변의..
[백준] 3009번: 네 번째 점 - JAVA
·
Algorithm/백준
[작성일: 2023. 10. 02] https://www.acmicpc.net/problem/3009  풀이import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x1 = sc.nextInt(); int y1 = sc.nextInt(); int x2 = sc.nextInt(); int y2 = sc.nextInt(); int x3 = sc.nextInt(); int y3 = sc.nextInt(); int x = 0; ..