ALGORITHM ๐Ÿค–/Baekjoon

๋ฐฑ์ค€
https://www.acmicpc.net/problem/2562 2562๋ฒˆ: ์ตœ๋Œ“๊ฐ’ 9๊ฐœ์˜ ์„œ๋กœ ๋‹ค๋ฅธ ์ž์—ฐ์ˆ˜๊ฐ€ ์ฃผ์–ด์งˆ ๋•Œ, ์ด๋“ค ์ค‘ ์ตœ๋Œ“๊ฐ’์„ ์ฐพ๊ณ  ๊ทธ ์ตœ๋Œ“๊ฐ’์ด ๋ช‡ ๋ฒˆ์งธ ์ˆ˜์ธ์ง€๋ฅผ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ์„œ๋กœ ๋‹ค๋ฅธ 9๊ฐœ์˜ ์ž์—ฐ์ˆ˜ 3, 29, 38, 12, 57, 74, 40, 85, 61 ์ด ์ฃผ์–ด www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] a = new int[9]; int max = 0; int num = 0; for (int i = 0; i < 9; i++) { a[i..
https://www.acmicpc.net/problem/10818 10818๋ฒˆ: ์ตœ์†Œ, ์ตœ๋Œ€ ์ฒซ์งธ ์ค„์— ์ •์ˆ˜์˜ ๊ฐœ์ˆ˜ N (1 ≤ N ≤ 1,000,000)์ด ์ฃผ์–ด์ง„๋‹ค. ๋‘˜์งธ ์ค„์—๋Š” N๊ฐœ์˜ ์ •์ˆ˜๋ฅผ ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„ํ•ด์„œ ์ฃผ์–ด์ง„๋‹ค. ๋ชจ๋“  ์ •์ˆ˜๋Š” -1,000,000๋ณด๋‹ค ํฌ๊ฑฐ๋‚˜ ๊ฐ™๊ณ , 1,000,000๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™์€ ์ •์ˆ˜์ด๋‹ค. 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[] a = new int[n]; for (int i..
https://www.acmicpc.net/problem/10871 10871๋ฒˆ: X๋ณด๋‹ค ์ž‘์€ ์ˆ˜ ์ฒซ์งธ ์ค„์— N๊ณผ X๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. (1 ≤ N, X ≤ 10,000) ๋‘˜์งธ ์ค„์— ์ˆ˜์—ด A๋ฅผ ์ด๋ฃจ๋Š” ์ •์ˆ˜ N๊ฐœ๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ์ฃผ์–ด์ง€๋Š” ์ •์ˆ˜๋Š” ๋ชจ๋‘ 1๋ณด๋‹ค ํฌ๊ฑฐ๋‚˜ ๊ฐ™๊ณ , 10,000๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™์€ ์ •์ˆ˜์ด๋‹ค. www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int x = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i..
https://www.acmicpc.net/problem/10807 10807๋ฒˆ: ๊ฐœ์ˆ˜ ์„ธ๊ธฐ ์ฒซ์งธ ์ค„์— ์ •์ˆ˜์˜ ๊ฐœ์ˆ˜ N(1 ≤ N ≤ 100)์ด ์ฃผ์–ด์ง„๋‹ค. ๋‘˜์งธ ์ค„์—๋Š” ์ •์ˆ˜๊ฐ€ ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„๋˜์–ด์ ธ์žˆ๋‹ค. ์…‹์งธ ์ค„์—๋Š” ์ฐพ์œผ๋ ค๊ณ  ํ•˜๋Š” ์ •์ˆ˜ v๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ์ž…๋ ฅ์œผ๋กœ ์ฃผ์–ด์ง€๋Š” ์ •์ˆ˜์™€ v๋Š” -100๋ณด๋‹ค ํฌ๊ฑฐ www.acmicpc.net 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[n]; for (int i = 0; i < n; i++) { arr[i]..
https://www.acmicpc.net/problem/13458 13458๋ฒˆ: ์‹œํ—˜ ๊ฐ๋… ์ฒซ์งธ ์ค„์— ์‹œํ—˜์žฅ์˜ ๊ฐœ์ˆ˜ N(1 ≤ N ≤ 1,000,000)์ด ์ฃผ์–ด์ง„๋‹ค. ๋‘˜์งธ ์ค„์—๋Š” ๊ฐ ์‹œํ—˜์žฅ์— ์žˆ๋Š” ์‘์‹œ์ž์˜ ์ˆ˜ Ai (1 ≤ Ai ≤ 1,000,000)๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ์…‹์งธ ์ค„์—๋Š” B์™€ C๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. (1 ≤ B, C ≤ 1,000,000) www.acmicpc.net 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[n]; // ์‹œํ—˜์žฅ์— ์žˆ๋Š”..
https://www.acmicpc.net/problem/1769 1769๋ฒˆ: 3์˜ ๋ฐฐ์ˆ˜ ๋ฌธ์ œ๊ฐ€ ์ž˜ ํ’€๋ฆฌ์ง€ ์•Š์„ ๋•Œ, ๋ฌธ์ œ๋ฅผ ๋ฐ”๋ผ๋ณด๋Š” ์‹œ๊ฐ์„ ์กฐ๊ธˆ๋งŒ ๋‹ค๋ฅด๊ฒŒ ๊ฐ€์ง€๋ฉด ๋ฌธ์ œ๊ฐ€ ์‰ฝ๊ฒŒ ํ’€๋ฆฌ๋Š” ๊ฒฝํ—˜์„ ์ข…์ข… ํ•ด ๋ณด์•˜์„ ๊ฒƒ์ด๋‹ค. ์—ฌ๋Ÿฌ ๊ฐ€์ง€ ๋ฐฉ๋ฒ•์ด ์žˆ์ง€๋งŒ ๊ทธ ์ค‘ ํ•˜๋‚˜๋กœ ์šฐ๋ฆฌ๊ฐ€ ํ’€๊ณ  ์‹ถ์€ ๋ฌธ์ œ๋ฅผ www.acmicpc.net import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStrea..
https://www.acmicpc.net/problem/1271 1271๋ฒˆ: ์—„์ฒญ๋‚œ ๋ถ€์ž2 ์ฒซ์งธ ์ค„์—๋Š” ์ตœ๋ฐฑ์ค€ ์กฐ๊ต๊ฐ€ ๊ฐ€์ง„ ๋ˆ n๊ณผ ๋ˆ์„ ๋ฐ›์œผ๋Ÿฌ ์˜จ ์ƒ๋ช…์ฒด์˜ ์ˆ˜ m์ด ์ฃผ์–ด์ง„๋‹ค. (1 ≤ m ≤ n ≤ 101000, m๊ณผ n์€ 10์ง„์ˆ˜ ์ •์ˆ˜) www.acmicpc.net import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); BigInteger n = sc.nextBigInteger(); BigInteger m = sc.nextBigInteger(); BigInteger cost = n.d..
daxx0ne
'ALGORITHM ๐Ÿค–/Baekjoon' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (5 Page)