๋ฐ์ํ ์ ์ฒด ๊ธ743 [๋ฐฑ์ค ์๊ณ ๋ฆฌ์ฆ] 10951๋ฒ - A+B - 4 4. while๋ฌธ - A+B - 4 ๋ฌธ์ ) ๋ ์ ์ A์ B๋ฅผ ์ ๋ ฅ๋ฐ์ ๋ค์, A+B๋ฅผ ์ถ๋ ฅํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค. ์ ๋ ฅ ์ถ๋ ฅ 1 1 2 3 3 4 9 8 5 2 2 5 7 17 7 import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); while (sc.hasNextInt()) { // ์ ๋ ฅ๊ฐ์ด int๋ฉด true๋ฅผ ๋ฐํํ์ฌ while๋ฌธ์ ์คํ/ int a = sc.nextInt(); // ๊ทธ๋ ์ง ์์ผ๋ฉด false๋ฅผ ๋ฐํํ์ฌ while๋ฌธ ์ข ๋ฃ. int b = sc.nextInt(); System.out.println(a + b); // .. 2021. 2. 1. [๋ฐฑ์ค ์๊ณ ๋ฆฌ์ฆ] 10952๋ฒ - A+B - 5 4. while๋ฌธ - A+B - 5 ๋ฌธ์ ) ๋ ์ ์ A์ B๋ฅผ ์ ๋ ฅ๋ฐ์ ๋ค์, A+B๋ฅผ ์ถ๋ ฅํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค. ์ ๋ ฅ์ ๋ง์ง๋ง์๋ 0 ๋ ๊ฐ๊ฐ ๋ค์ด์จ๋ค. ์ ๋ ฅ ์ถ๋ ฅ 1 1 2 3 3 4 9 8 5 2 0 0 2 5 7 17 7 import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); while (true) { // ํน์ ์กฐ๊ฑด์ ๋ง์กฑํ ๋๊น์ง ๋ฐ๋ณต๋ฌธ์ ์คํ int a = sc.nextInt(); int b = sc.nextInt(); if (a == 0 && b == 0) { // a์ b๊ฐ 0์ด๋ฉด ๋ฉ์ถค break; // while๋ฌธ ๋น ์ ธ.. 2021. 2. 1. [๋ฐฑ์ค ์๊ณ ๋ฆฌ์ฆ] 10871๋ฒ - X๋ณด๋ค ์์ ์ 3. for๋ฌธ - X๋ณด๋ค ์์ ์ ๋ฌธ์ ) ์ ์ N๊ฐ๋ก ์ด๋ฃจ์ด์ง ์์ด A์ ์ ์ X๊ฐ ์ฃผ์ด์ง๋ค. ์ด๋, A์์ X๋ณด๋ค ์์ ์๋ฅผ ๋ชจ๋ ์ถ๋ ฅํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค. ์ ๋ ฅ ์ถ๋ ฅ 10 5 1 10 4 9 2 3 8 5 7 6 1 4 2 3 import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); // 10 int X = sc.nextInt(); // 5 int a[] = new int[N]; for (int i = 0; i < N; i++) { // ๋ฐฐ์ด ์(N) ๋๊น์ง ์ถ๋ ฅ a[i] = sc.nextInt.. 2021. 2. 1. [๋ฐฑ์ค ์๊ณ ๋ฆฌ์ฆ] 2439๋ฒ - ๋ณ ์ฐ๊ธฐ - 2 3. for๋ฌธ - ๋ณ ์ฐ๊ธฐ 2 ๋ฌธ์ ) ์ฒซ์งธ ์ค์๋ ๋ณ 1๊ฐ, ๋์งธ ์ค์๋ ๋ณ 2๊ฐ, N๋ฒ์งธ ์ค์๋ ๋ณ N๊ฐ๋ฅผ ์ฐ๋ ๋ฌธ์ ํ์ง๋ง, ์ค๋ฅธ์ชฝ์ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌํ ๋ณ(์์ ์ฐธ๊ณ )์ ์ถ๋ ฅํ์์ค. ์ ๋ ฅ ์ถ๋ ฅ 5 * ** *** **** ***** import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 1; i i; j--) { // j๋ n์ด๊ณ j๊ฐ i๋ณด๋ค ํด๋ j๋ฅผ ๊ฐ์ System.out.print(" "); // ๊ณต๋ฐฑ ์ถ๋ ฅ. ๊ณต๋ฐฑ4์นธ-3์นธ-2์นธ-1์นธ ์ } for (int k = 0; .. 2021. 1. 31. [๋ฐฑ์ค ์๊ณ ๋ฆฌ์ฆ] 2438๋ฒ - ๋ณ ์ฐ๊ธฐ - 1 3. for๋ฌธ - ๋ณ ์ฐ๊ธฐ - 1 ๋ฌธ์ ) ์ฒซ์งธ ์ค์๋ ๋ณ 1๊ฐ, ๋์งธ ์ค์๋ ๋ณ 2๊ฐ, N๋ฒ์งธ ์ค์๋ ๋ณ N๊ฐ๋ฅผ ์ฐ๋ ๋ฌธ์ ์ ๋ ฅ ์ถ๋ ฅ 5 * ** *** **** ***** import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 0; i < n; i++) { // i๋ 0์ด๊ณ i๊ฐ n๋ณด๋ค ์์๋ i๊ฐ ์ถ๋ ฅ ํ ์ฆ๊ฐ for (int j = 0; j 2021. 1. 31. [๋ฐฑ์ค ์๊ณ ๋ฆฌ์ฆ] 11022๋ฒ - A+B - 8 3. for๋ฌธ - A+B - 8 ๋ฌธ์ ) ๋ ์ ์ A์ B๋ฅผ ์ ๋ ฅ๋ฐ์ ๋ค์, A+B๋ฅผ ์ถ๋ ฅํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค. ์ ๋ ฅ ์ถ๋ ฅ 5 1 1 2 3 3 4 9 8 5 2 Case #1: 1 + 1 = 2 Case #2: 2 + 3 = 5 Case #3: 3 + 4 = 7 Case #4: 9 + 8 = 17 Case #5: 5 + 2 = 7 import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 1; i 2021. 1. 31. ์ด์ 1 ยทยทยท 106 107 108 109 110 111 112 ยทยทยท 124 ๋ค์ ๋ฐ์ํ