ALGORITHM ๐Ÿค–/Baekjoon

๋ฐฑ์ค€
https://www.acmicpc.net/problem/1037 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } Arrays.sort(arr); int answer = arr[0] * arr[arr.length - 1]; System.out.println(answer); } }
https://www.acmicpc.net/problem/1009 1009๋ฒˆ: ๋ถ„์‚ฐ์ฒ˜๋ฆฌ ์ž…๋ ฅ์˜ ์ฒซ ์ค„์—๋Š” ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค์˜ ๊ฐœ์ˆ˜ T๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ๊ทธ ๋‹ค์Œ ์ค„๋ถ€ํ„ฐ ๊ฐ๊ฐ์˜ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค์— ๋Œ€ํ•ด ์ •์ˆ˜ a์™€ b๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. (1 ≤ a < 100, 1 ≤ b < 1,000,000) www.acmicpc.net import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { int a = sc.nextInt(); int b = sc.nextInt(); int num = 1; fo..
https://www.acmicpc.net/problem/11501 11501๋ฒˆ: ์ฃผ์‹ ์ž…๋ ฅ์˜ ์ฒซ ์ค„์—๋Š” ํ…Œ์ŠคํŠธ์ผ€์ด์Šค ์ˆ˜๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ์ž์—ฐ์ˆ˜ T๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ๊ฐ ํ…Œ์ŠคํŠธ์ผ€์ด์Šค ๋ณ„๋กœ ์ฒซ ์ค„์—๋Š” ๋‚ ์˜ ์ˆ˜๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ์ž์—ฐ์ˆ˜ N(2 ≤ N ≤ 1,000,000)์ด ์ฃผ์–ด์ง€๊ณ , ๋‘˜์งธ ์ค„์—๋Š” ๋‚  ๋ณ„ ์ฃผ๊ฐ€๋ฅผ ๋‚˜ํƒ€ www.acmicpc.net import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { int n = sc.nextInt(); long[] arr = new long[n]..
https://www.acmicpc.net/problem/2750 2750๋ฒˆ: ์ˆ˜ ์ •๋ ฌํ•˜๊ธฐ ์ฒซ์งธ ์ค„์— ์ˆ˜์˜ ๊ฐœ์ˆ˜ N(1 ≤ N ≤ 1,000)์ด ์ฃผ์–ด์ง„๋‹ค. ๋‘˜์งธ ์ค„๋ถ€ํ„ฐ N๊ฐœ์˜ ์ค„์—๋Š” ์ˆ˜๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ์ด ์ˆ˜๋Š” ์ ˆ๋Œ“๊ฐ’์ด 1,000๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™์€ ์ •์ˆ˜์ด๋‹ค. ์ˆ˜๋Š” ์ค‘๋ณต๋˜์ง€ ์•Š๋Š”๋‹ค. www.acmicpc.net import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for(int i = 0; i < n; i++){ int num = sc.nextInt(); arr[i] = nu..
https://www.acmicpc.net/problem/11727 11727๋ฒˆ: 2×n ํƒ€์ผ๋ง 2 2×n ์ง์‚ฌ๊ฐํ˜•์„ 1×2, 2×1๊ณผ 2×2 ํƒ€์ผ๋กœ ์ฑ„์šฐ๋Š” ๋ฐฉ๋ฒ•์˜ ์ˆ˜๋ฅผ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. ์•„๋ž˜ ๊ทธ๋ฆผ์€ 2×17 ์ง์‚ฌ๊ฐํ˜•์„ ์ฑ„์šด ํ•œ๊ฐ€์ง€ ์˜ˆ์ด๋‹ค. www.acmicpc.net import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] dp = new int[n + 1]; ..
https://www.acmicpc.net/problem/2003 2003๋ฒˆ: ์ˆ˜๋“ค์˜ ํ•ฉ 2 ์ฒซ์งธ ์ค„์— N(1 ≤ N ≤ 10,000), M(1 ≤ M ≤ 300,000,000)์ด ์ฃผ์–ด์ง„๋‹ค. ๋‹ค์Œ ์ค„์—๋Š” A[1], A[2], …, A[N]์ด ๊ณต๋ฐฑ์œผ๋กœ ๋ถ„๋ฆฌ๋˜์–ด ์ฃผ์–ด์ง„๋‹ค. ๊ฐ๊ฐ์˜ A[x]๋Š” 30,000์„ ๋„˜์ง€ ์•Š๋Š” ์ž์—ฐ์ˆ˜์ด๋‹ค. www.acmicpc.net import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] arr = new int[n]; // ์ˆ˜์—ด์„ ๋‹ด์„ ๋ฐฐ์—ด i..
https://www.acmicpc.net/problem/20044 20044๋ฒˆ: Project Teams ์ž…๋ ฅ์€ ํ‘œ์ค€์ž…๋ ฅ์„ ์‚ฌ์šฉํ•œ๋‹ค. ์ž…๋ ฅ์˜ ์ฒซ ๋ฒˆ์งธ ํ–‰์—๋Š” ํŒ€ ์ˆ˜๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ์–‘์˜ ์ •์ˆ˜ n(1 ≤ n ≤ 5,000)์ด ์ฃผ์–ด์ง„๋‹ค. ๊ทธ ๋‹ค์Œ ํ–‰์— ํ•™์ƒ si ์˜ ์ฝ”๋”ฉ ์—ญ๋Ÿ‰ w(si)๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” 2n๊ฐœ์˜ ์–‘์˜ ์ •์ˆ˜๊ฐ€ ๊ณต๋ฐฑ์œผ๋กœ www.acmicpc.net import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[2 * n]; for..
daxx0ne
'ALGORITHM ๐Ÿค–/Baekjoon' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (4 Page)