๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๋ฐ˜์‘ํ˜•

IT Blog404

[๋ฐฑ์ค€] 10539๋ฒˆ: ์ˆ˜๋นˆ์ด์™€ ์ˆ˜์—ด https://www.acmicpc.net/problem/10539 10539๋ฒˆ: ์ˆ˜๋นˆ์ด์™€ ์ˆ˜์—ด ๋ฌธ์ œ ์ˆ˜๋นˆ์ด๋Š” ์‹ฌ์‹ฌํ•ด์„œ ์ˆ˜์—ด์„ ๊ฐ€์ง€๊ณ  ๋†€๊ณ  ์žˆ๋‹ค. ๋จผ์ €, ์ •์ˆ˜ ์ˆ˜์—ด A๋ฅผ ์“ด๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๊ทธ ์•„๋ž˜์— ์ •์ˆ˜ ์ˆ˜์—ด A์˜ ํ•ด๋‹น ํ•ญ๊นŒ์ง€์˜ ํ‰๊ท ๊ฐ’์„ ๊ทธ ํ•ญ์œผ๋กœ ํ•˜๋Š” ์ •์ˆ˜ ์ˆ˜์—ด B๋ฅผ ์“ด๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ์ˆ˜์—ด A๏ฟฝ๏ฟฝ www.acmicpc.net ์ฝ”๋“œ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int B = scan.nextInt(); int[] bArr = new int[B]; int[] aArr = new int[B]; for(int i=0; i 2020. 5. 20.
[๋ฐฑ์ค€] 2909๋ฒˆ: ์บ”๋”” ๊ตฌ๋งค(๊ตฌํ˜„) https://www.acmicpc.net/problem/2909 2909๋ฒˆ: ์บ”๋”” ๊ตฌ๋งค ๋ฌธ์ œ ์˜ค๋Š˜์€ ํ™”์ดํŠธ๋ฐ์ด์ด๋‹ค. ์ƒ๊ทผ์ด๋Š” ์—ฌ์ž์นœ๊ตฌ๋ฅผ ์œ„ํ•ด์„œ ์‚ฌํƒ•์„ ์‚ฌ๋ ค๊ณ  ํ•œ๋‹ค. ํ•˜์ง€๋งŒ, ์ƒ๊ทผ์ด๋Š” ๋…ํŠนํ•œ ์„ฑ๊ฒฉ์„ ๊ฐ€์ง€๊ณ  ์žˆ์–ด์„œ, ํŠน์ • ์•ก๋ฉด๊ฐ€์˜ ์ง€ํ๋งŒ ๊ฐ€์ง€๊ณ  ์žˆ๋Š”๋‹ค. ๋˜, ๊ฑฐ์Šค๋ฆ„๋ˆ์€ ๋ฐ›์ง€ ์•Š๏ฟฝ๏ฟฝ www.acmicpc.net ์ฝ”๋“œ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int C = scan.nextInt();// ์‚ฌํƒ• ๊ฐ€๊ฒฉ int K = scan.nextInt();// 0์˜ ๊ฐœ์ˆ˜ double num = Math.pow(10, K);// .. 2020. 5. 18.
[๋ฐฑ์ค€] 8320๋ฒˆ: ์ง์‚ฌ๊ฐํ˜•์„ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ• https://www.acmicpc.net/problem/8320 8320๋ฒˆ: ์ง์‚ฌ๊ฐํ˜•์„ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ• ๋ฌธ์ œ ์ƒ๊ทผ์ด๋Š” ๋ณ€์˜ ๊ธธ์ด๊ฐ€ 1์ธ ์ •์‚ฌ๊ฐํ˜• n๊ฐœ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค. ์ด ์ •์‚ฌ๊ฐํ˜•์„ ์ด์šฉํ•ด์„œ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋Š” ์ง์‚ฌ๊ฐํ˜•์˜ ๊ฐœ์ˆ˜๋Š” ์ด ๋ช‡ ๊ฐœ์ผ๊นŒ? ๋‘ ์ง์‚ฌ๊ฐํ˜• A์™€ B๊ฐ€ ์žˆ์„ ๋•Œ, A๋ฅผ ์ด๋™, ํšŒ์ „์‹œ์ผœ์„œ B๋ฅผ ๋งŒ๋“ค www.acmicpc.net ์ฝ”๋“œ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int count = 0; for(int i=1; i 2020. 5. 17.
[๋ฐฑ์ค€] 2783๋ฒˆ: ์‚ผ๊ฐ ๊น€๋ฐฅ(๊ตฌํ˜„) https://www.acmicpc.net/problem/2783 2783๋ฒˆ: ์‚ผ๊ฐ ๊น€๋ฐฅ ๋ฌธ์ œ ์œ ๋ช… ํŽธ์˜์  ์ฒด์ธ์  ์„ธ๋ธ25๋Š” ์‚ผ๊ฐ ๊น€๋ฐฅ์„ ์ „๊ตญ์—์„œ ๊ฐ€์žฅ ์‹ธ๊ฒŒ ํŒ๋งคํ•˜๊ณ  ์žˆ๋‹ค. ์ด ํšŒ์‚ฌ์˜ ์ง์›๋“ค์€ ์‚ผ๊ฐ ๊น€๋ฐฅ์˜ ๊ฐ€๊ฒฉ์„ ์ „๊ตญ ์ตœ์ €๊ฐ€๋ฅผ ์œ ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ๋งค์ผ ๊ทผ์ฒ˜์˜ ํŽธ์˜์ ์„ ๋ฐฉ๋ฌธํ•œ๋‹ค. ๊ทธ๏ฟฝ๏ฟฝ www.acmicpc.net ์ฝ”๋“œ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int X = scan.nextInt();// X์› int Y = scan.nextInt();// Y๊ทธ๋žจ int N = scan.nextInt();// ํŽธ์˜์  ๊ฐฏ์ˆ˜ doub.. 2020. 5. 16.
[๋ฐฑ์ค€] 3034๋ฒˆ: ์•ต๊ทธ๋ฆฌ ์ฐฝ์˜ https://www.acmicpc.net/problem/3034 3034๋ฒˆ: ์•ต๊ทธ๋ฆฌ ์ฐฝ์˜ ๋ฌธ์ œ ์ฐฝ์˜์ด๋Š” ํ™”๊ฐ€๋‚˜์„œ ์„ฑ๋ƒฅ์„ ๋ฐ”๋‹ฅ์— ๋˜์กŒ๋‹ค. ์ƒ๊ทผ์ด๋Š” ๋ฐ”๋‹ฅ์ด ๋”๋Ÿฌ์›Œ์ง„ ๊ฒƒ์„ ๋ณด๊ณ  ์ฐฝ์˜์ด๋ฅผ ๋งค์šฐ ํ˜ผ๋ƒˆ๋‹ค. ๊ฐ•์‚ฐ์ด๋Š” ๊ทผ์ฒ˜์—์„œ ๋ฐ•์Šค๋ฅผ ๋ฐœ๊ฒฌํ–ˆ๋‹ค. ์ƒ๋•์ด๋Š” ๊ฐ•์‚ฐ์ด๊ฐ€ ๋ฐœ๊ฒฌํ•œ ๋ฐ•์Šค๋ฅผ ์ƒ๊ทผ์ด์—๏ฟฝ๏ฟฝ www.acmicpc.net ์ฝ”๋“œ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int W = scan.nextInt(); int H = scan.nextInt(); for(int i=0; i= (len*len)).. 2020. 5. 15.
[๋ฐฑ์ค€] 9517๋ฒˆ: ์•„์ด ๋Ÿฌ๋ธŒ ํฌ๋กœ์•„ํ‹ฐ์•„ https://www.acmicpc.net/problem/9517 9517๋ฒˆ: ์•„์ด ๋Ÿฌ๋ธŒ ํฌ๋กœ์•„ํ‹ฐ์•„ ๋ฌธ์ œ "I love Croatia"๋Š” ๋„ค๋ธ๋ž€๋“œ์˜ ์ธ๊ธฐ ํ‹ฐ๋น„ ํ”„๋กœ๊ทธ๋žจ "I love my country"์˜ ํฌ๋งท ๋ผ์ด์„ผ์Šค๋ฅผ ์ˆ˜์ž…ํ•ด ๋งŒ๋“  ํฌ๋กœ์•„ํ‹ฐ์•„์˜ ํ‹ฐ๋น„์‡ผ์ด๋‹ค. ์ด ํ‹ฐ๋น„์‡ผ์—์„œ ๊ฐ€์žฅ ์ธ๊ธฐ์žˆ๋Š” ๊ฒŒ์ž„์€ "Happy Birthday"์ด๋ฉฐ, ์ด ๊ฒŒ์ž„์— www.acmicpc.net ์ฝ”๋“œ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int K = scan.nextInt();// ํญํƒ„ ๋“ค๊ณ ์žˆ๋Š” ์‚ฌ๋žŒ ๋ฒˆํ˜ธ int N = scan.nextInt().. 2020. 5. 12.
[๋ฐฑ์ค€] 2455๋ฒˆ: ์ง€๋Šฅํ˜• ๊ธฐ์ฐจ https://www.acmicpc.net/problem/2455 2455๋ฒˆ: ์ง€๋Šฅํ˜• ๊ธฐ์ฐจ ์ตœ๊ทผ์— ๊ฐœ๋ฐœ๋œ ์ง€๋Šฅํ˜• ๊ธฐ์ฐจ๊ฐ€ 1๋ฒˆ์—ญ(์ถœ๋ฐœ์—ญ)๋ถ€ํ„ฐ 4๋ฒˆ์—ญ(์ข…์ฐฉ์—ญ)๊นŒ์ง€ 4๊ฐœ์˜ ์ •์ฐจ์—ญ์ด ์žˆ๋Š” ๋…ธ์„ ์—์„œ ์šดํ–‰๋˜๊ณ  ์žˆ๋‹ค. ์ด ๊ธฐ์ฐจ์—๋Š” ํƒ€๊ฑฐ๋‚˜ ๋‚ด๋ฆฌ๋Š” ์‚ฌ๋žŒ ์ˆ˜๋ฅผ ์ž๋™์œผ๋กœ ์ธ์‹ํ•  ์ˆ˜ ์žˆ๋Š” ์žฅ์น˜๊ฐ€ ์žˆ๋‹ค. ๏ฟฝ www.acmicpc.net ์ฝ”๋“œ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int people = 0; int max = -1; for(int i=0; i 2020. 5. 12.
[๋ฐฑ์ค€] 1547๋ฒˆ: ๊ณต https://www.acmicpc.net/problem/1547 1547๋ฒˆ: ๊ณต ์ฒซ์งธ ์ค„์— ์ปต์˜ ์œ„์น˜๋ฅผ ๋ฐ”๊พผ ํšŸ์ˆ˜ M์ด ์ฃผ์–ด์ง€๋ฉฐ, M์€ 50๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™์€ ์ž์—ฐ์ˆ˜์ด๋‹ค. ๋‘˜์งธ ์ค„๋ถ€ํ„ฐ M๊ฐœ์˜ ์ค„์—๋Š” ์ปต์˜ ์œ„์น˜๋ฅผ ๋ฐ”๊พผ ๋ฐฉ๋ฒ• X์™€ Y๊ฐ€ ์ฃผ์–ด์ง€๋ฉฐ, X๋ฒˆ ์ปต๊ณผ Y๋ฒˆ ์ปต์˜ ์œ„์น˜๋ฅผ ์„œ๋กœ ๋ฐ”๊พธ๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•œ๋‹ค. ์ปต์„ ์ด๋™์‹œํ‚ค๋Š” ์ค‘์— ๊ณต์ด ์ปต์—์„œ ๋น ์ ธ๋‚˜์˜ค๋Š” ๊ฒฝ์šฐ๋Š” ์—†๋‹ค. X์™€ Y์˜ ๊ฐ’์€ 3๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™๊ณ , X์™€ Y๊ฐ€ ๊ฐ™์„ ์ˆ˜๋„ ์žˆ๋‹ค. www.acmicpc.net ์ฝ”๋“œ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int M = scan.ne.. 2020. 5. 12.
[๋ฐฑ์ค€] 1773๋ฒˆ: ํญ์ฃฝ์‡ผ(๊ตฌํ˜„) https://www.acmicpc.net/problem/1773 1773๋ฒˆ: ํญ์ฃฝ์‡ผ ๋ฌธ์ œ ํ•™์ƒ๋“ค์€ 3์ฃผ๊ฐ€ ์ง€๋‚œ ๊ธฐ๋…์œผ๋กœ ๋งค์ ์—์„œ 1์›” 1์ผ์ด ์ง€๋‚˜ ์‹ธ๊ฒŒ ํŒŒ๋Š” ํญ์ฃฝ์„ ์‚ฌ์„œ ํ„ฐ๋œจ๋ฆฌ๊ณ  ์žˆ๋‹ค. ํญ์ฃฝ์‡ผ๋ฅผ ํ•˜๋Š” ๋™์•ˆ N๋ช…์˜ ํ•™์ƒ๋“ค์ด ํญ์ฃฝ์„ ํ„ฐ๋œจ๋ฆฐ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์ด N๋ช…์˜ ํ•™์ƒ์€ ๊ฐ๊ฐ ์ผ์ •ํ•œ ์ฃผ๊ธฐ๋กœ ํญ์ฃฝ์„ ํ„ฐ๋œจ๋ฆฐ๋‹ค. ๋ฌผ๋ก  ์ด ์ฃผ๊ธฐ๋Š” ํ•™์ƒ๋“ค๋งˆ๋‹ค ๊ฐ™์„ ์ˆ˜๋„, ๋‹ค๋ฅผ ์ˆ˜๋„ ์žˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์šฐ๋ฆฌ๋Š” ์ดˆ ๋‹จ์œ„๋กœ ๊ด€์ฐฐ์„ ํ•˜๊ณ , ํญ์ฃฝ ์—ญ์‹œ ์ดˆ ๋‹จ์œ„๋กœ ํ„ฐ์ง„๋‹ค. ํญ์ฃฝ์‡ผ๊ฐ€ ๋๋‚  ๋•Œ๊นŒ์ง€ ์–ผ๋งˆ๋‚˜ ๋งŽ์€ ์‹œ๊ฐ„๋™์•ˆ ๋ฐคํ•˜๋Š˜์— ํญ์ฃฝ์ด ํ„ฐ์ง€๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๋Š”์ง€ ๊ถ๊ธˆํ•ด ํ•˜๋Š” ์กฐ๊ต๋ฅผ ๋„์™€์ฃผ์ž www.acmicpc.net ์ฝ”๋“œ import java.util.Scanner; public class Main { public static int solve(int .. 2020. 5. 3.
[๋ฐฑ์ค€] 5612๋ฒˆ: ํ„ฐ๋„์˜ ์ž…๊ตฌ์™€ ์ถœ๊ตฌ https://www.acmicpc.net/problem/5612 5612๋ฒˆ: ํ„ฐ๋„์˜ ์ž…๊ตฌ์™€ ์ถœ๊ตฌ ๋ฌธ์ œ ์ƒ๊ทผ์ด๋Š” ๋‚จ์‚ฐ1ํ˜ธํ„ฐ๋„์˜ ์ž…๊ตฌ์™€ ์ถœ๊ตฌ์—์„œ 1๋ถ„์— ํ†ต๊ณผํ•˜๋Š” ์ฐจ๋Ÿ‰์˜ ์ˆ˜๋ฅผ ์กฐ์‚ฌํ–ˆ๋‹ค. ์ด๋•Œ, ํ„ฐ๋„์— ์ฐจ๋Ÿ‰์ด ๊ฐ€์žฅ ๋งŽ์ด ์žˆ์—ˆ์„ ๋•Œ, ๋ช‡ ๋Œ€ ์žˆ์—ˆ๋Š”์ง€ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. ์ž…๋ ฅ ์ฒซ์งธ ์ค„์— www.acmicpc.net ์ฝ”๋“œ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt();// ์กฐ์‚ฌํ•œ ์‹œ๊ฐ„ int m = scan.nextInt();// ํ„ฐ๋„์•ˆ ์ฐจ๋Ÿ‰ ์ˆ˜ int temp = m; int resul.. 2020. 5. 1.
๋ฐ˜์‘ํ˜•