분류 전체보기
백준 22864번
문제 https://www.acmicpc.net/problem/22864 22864번: 피로도 첫 번째 줄에 네 정수 $A$, $B$, $C$, $M$이 공백으로 구분되어 주어진다. 맨 처음 피로도는 0이다. www.acmicpc.net import java.util.Scanner; public class Main22864 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); int M = sc.nextInt(); sc.close(); int count = 0; int work = 0; for (in..
백준 19532번
문제 https://www.acmicpc.net/problem/19532 19532번: 수학은 비대면강의입니다 정수 $a$, $b$, $c$, $d$, $e$, $f$가 공백으로 구분되어 차례대로 주어진다. ($-999 \leq a,b,c,d,e,f \leq 999$) 문제에서 언급한 방정식을 만족하는 $\left(x,y\right)$가 유일하게 존재하고, 이 때 $x$와 $y$가 각각 $- www.acmicpc.net import java.util.Scanner; public class Main19532 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] arr = new int[6]; int xAns..
백준 2231번
문제 https://www.acmicpc.net/problem/2231 2231번: 분해합 어떤 자연수 N이 있을 때, 그 자연수 N의 분해합은 N과 N을 이루는 각 자리수의 합을 의미한다. 어떤 자연수 M의 분해합이 N인 경우, M을 N의 생성자라 한다. 예를 들어, 245의 분해합은 256(=245+2+4+5)이 www.acmicpc.net import java.util.Scanner; public class Main2231 { static int N; // 입력받은 정수(분해합) static int ans = Integer.MAX_VALUE; // 생성자(최대값으로 초기화) // 분해합, 인덱스를 인자로 받는다. public static void constructor(int res, int idx)..
백준 14889번
문제 https://www.acmicpc.net/problem/14889 14889번: 스타트와 링크 예제 2의 경우에 (1, 3, 6), (2, 4, 5)로 팀을 나누면 되고, 예제 3의 경우에는 (1, 2, 4, 5), (3, 6, 7, 8)로 팀을 나누면 된다. www.acmicpc.net import java.util.Scanner; public class Main14889 { public static int N; public static int person[]; public static int ans[]; public static boolean check[]; public static int status[][]; public static int[] start; public static int[]..
백준 2798번
문제 https://www.acmicpc.net/problem/2798 2798번: 블랙잭 첫째 줄에 카드의 개수 N(3 ≤ N ≤ 100)과 M(10 ≤ M ≤ 300,000)이 주어진다. 둘째 줄에는 카드에 쓰여 있는 수가 주어지며, 이 값은 100,000을 넘지 않는 양의 정수이다. 합이 M을 넘지 않는 카드 3장 www.acmicpc.net import java.util.Scanner; public class Main2798 { public static int N; public static int M; public static int arr[]; public static int ans[]; public static boolean check[]; public static int result; pub..
백준 10819번 ☆
문제 https://www.acmicpc.net/problem/10819 10819번: 차이를 최대로 첫째 줄에 N (3 ≤ N ≤ 8)이 주어진다. 둘째 줄에는 배열 A에 들어있는 정수가 주어진다. 배열에 들어있는 정수는 -100보다 크거나 같고, 100보다 작거나 같다. www.acmicpc.net import java.util.Scanner; public class Main10819 { public static int N; public static int[] A; public static int[] B; public static boolean[] check; public static int answer; public static void compare(int n) { int sum = 0; if (..