From 81340cd544ce4e0903cb9463aef7b93eafecae13 Mon Sep 17 00:00:00 2001 From: HwanHui Date: Mon, 22 Jun 2026 00:59:12 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=EA=B9=80=ED=99=98=ED=9D=AC:=20=EC=BD=94?= =?UTF-8?q?=EB=94=A9=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=EC=A0=9D=ED=8A=B8=20=EC=B4=88=EA=B8=B0=ED=99=94=20=EB=B0=8F=20?= =?UTF-8?q?=EC=9E=90=EB=A6=BF=EC=88=98=20=EB=8D=94=ED=95=98=EA=B8=B0(Lv.1)?= =?UTF-8?q?=20=ED=92=80=EC=9D=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 6 ++++++ CodingTest/README.md | 16 ++++++++++++++++ README.md | 17 ++++++++++++++++- Solutions/Main.java | 11 +++++++++++ Solutions/SumOfDigits.java | 16 ++++++++++++++++ 5 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 CodingTest/README.md create mode 100644 Solutions/Main.java create mode 100644 Solutions/SumOfDigits.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e5cae47 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +# IntelliJ IDEA +.idea/ +*.iml + +# Compiled output +out/ diff --git a/CodingTest/README.md b/CodingTest/README.md new file mode 100644 index 0000000..58affa8 --- /dev/null +++ b/CodingTest/README.md @@ -0,0 +1,16 @@ +# 🧩 CodingTest +취업을 μœ„ν•œ μ½”λ”©ν…ŒμŠ€νŠΈ μ€€λΉ„ + +## πŸ‘€ 이름 + +- κΉ€ν™˜ν¬ + +## πŸ“Œ μ‚¬μš© μ–Έμ–΄ + +- Java + +## πŸ“‹ 풀이 λͺ©λ‘ + +| 문제 | λ‚œμ΄λ„ | 풀이 | +|------|--------|------| +| 자릿수 λ”ν•˜κΈ° | Lv.1 | [SumOfDigits.java](../Solutions/SumOfDigits.java) | diff --git a/README.md b/README.md index 74a10fa..e5fa255 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,17 @@ -# CodingTest +# 🧩 CodingTest 취업을 μœ„ν•œ μ½”λ”©ν…ŒμŠ€νŠΈ μ€€λΉ„ + +## πŸ‘€ 이름 + +- κΉ€ν™˜ν¬ + +## πŸ“Œ μ‚¬μš© μ–Έμ–΄ + +- Java + +## πŸ“‹ 풀이 λͺ©λ‘ + +| 문제 | λ‚œμ΄λ„ | 풀이 | +|------|--------|------| +| 자릿수 λ”ν•˜κΈ° | Lv.1 | [SumOfDigits.java](Solutions/SumOfDigits.java) | + diff --git a/Solutions/Main.java b/Solutions/Main.java new file mode 100644 index 0000000..c187be7 --- /dev/null +++ b/Solutions/Main.java @@ -0,0 +1,11 @@ +import java.util.*; + + +public class Main { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int N = sc.nextInt(); + sc.close(); + System.out.println(SumOfDigits.SumOfDigits(N)); + } +} \ No newline at end of file diff --git a/Solutions/SumOfDigits.java b/Solutions/SumOfDigits.java new file mode 100644 index 0000000..b996421 --- /dev/null +++ b/Solutions/SumOfDigits.java @@ -0,0 +1,16 @@ +import java.util.*; + +public class SumOfDigits { + + + public static int SumOfDigits(int n) { + int answer = 0; + String str = String.valueOf(n); + + for (int i = 0; i < str.length(); i++) { + answer += str.charAt(i) - '0'; + } + + return answer; + } +} From df37145846a592de0a61780fe3d0e262d9cde278 Mon Sep 17 00:00:00 2001 From: HwanHui Date: Fri, 3 Jul 2026 22:57:42 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=EB=AC=B8=EC=A0=9C=201=EA=B0=9C:=20?= =?UTF-8?q?=EB=91=90=20=EC=A0=95=EC=88=98=20=EC=82=AC=EC=9D=B4=EC=9D=98=20?= =?UTF-8?q?=ED=95=A9(Lv1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Solutions/Main.java | 5 +++-- Solutions/SumofTwoIntegers.java | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 Solutions/SumofTwoIntegers.java diff --git a/Solutions/Main.java b/Solutions/Main.java index c187be7..6914385 100644 --- a/Solutions/Main.java +++ b/Solutions/Main.java @@ -4,8 +4,9 @@ public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); - int N = sc.nextInt(); + int a = sc.nextInt(); + int b = sc.nextInt(); sc.close(); - System.out.println(SumOfDigits.SumOfDigits(N)); + System.out.println(SumofTwoIntegers.SumofTwoIntegers(a, b)); } } \ No newline at end of file diff --git a/Solutions/SumofTwoIntegers.java b/Solutions/SumofTwoIntegers.java new file mode 100644 index 0000000..d23df9c --- /dev/null +++ b/Solutions/SumofTwoIntegers.java @@ -0,0 +1,23 @@ +import java.util.*; + +public class SumofTwoIntegers { + + + public static long SumofTwoIntegers(int a, int b) { + long answer = 0; + + if (a == b) { + return a; + } else if (a < b) { + for (int i = a; i!=b; i++) { + answer += i; + } + return answer + b; + } else { + for (int i = b; i!=a; i++) { + answer += i; + } + return answer + a; + } + } +} From c43202ebfc3ab5391e7911c14f33a8969ca25cc2 Mon Sep 17 00:00:00 2001 From: HwanHui Date: Fri, 3 Jul 2026 22:59:14 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=EB=AC=B8=EC=A0=9C=201=EA=B0=9C:=20?= =?UTF-8?q?=EB=91=90=20=EC=A0=95=EC=88=98=20=EC=82=AC=EC=9D=B4=EC=9D=98=20?= =?UTF-8?q?=ED=95=A9(Lv1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e5fa255..ca8dea3 100644 --- a/README.md +++ b/README.md @@ -14,4 +14,5 @@ | 문제 | λ‚œμ΄λ„ | 풀이 | |------|--------|------| | 자릿수 λ”ν•˜κΈ° | Lv.1 | [SumOfDigits.java](Solutions/SumOfDigits.java) | +| 두 μ •μˆ˜ μ‚¬μ΄μ˜ ν•© | Lv.1 | [SumofTwoIntegers.java](Solutions/SumofTwoIntegers.java) | From 6cc797e1d05d3d1365ba2d428674f8c858f2ee0a Mon Sep 17 00:00:00 2001 From: HwanHui Date: Fri, 3 Jul 2026 23:01:42 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=EB=AC=B8=EC=A0=9C=201=EA=B0=9C:=20?= =?UTF-8?q?=EB=91=90=20=EC=A0=95=EC=88=98=20=EC=82=AC=EC=9D=B4=EC=9D=98=20?= =?UTF-8?q?=ED=95=A9(Lv1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Solutions/SumofTwoIntegers.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Solutions/SumofTwoIntegers.java b/Solutions/SumofTwoIntegers.java index d23df9c..981a6d2 100644 --- a/Solutions/SumofTwoIntegers.java +++ b/Solutions/SumofTwoIntegers.java @@ -20,4 +20,13 @@ public static long SumofTwoIntegers(int a, int b) { return answer + a; } } + + /** + * ν”Όλ“œλ°±: λ“±μ°¨μˆ˜μ—΄μ˜ ν•© 곡식을 μ΄μš©ν–ˆλ‹€λ©΄ 더 짧게, 높은 μ„±λŠ₯의 μ½”λ“œκ°€ κ°€λŠ₯해짐 + */ +// public long solution(int a, int b) { +// long min = Math.min(a, b); +// long max = Math.max(a, b); +// return (max - min + 1) * (min + max) / 2; +// } }