From 7698c396b08652c1b08c32002f4f42ec2eb4063d Mon Sep 17 00:00:00 2001 From: wlxorjs2 Date: Wed, 16 Aug 2023 20:42:39 +0900 Subject: [PATCH 01/10] [Solve] BJ2588 --- algorithm/src/bj2588.java | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 algorithm/src/bj2588.java diff --git a/algorithm/src/bj2588.java b/algorithm/src/bj2588.java new file mode 100644 index 0000000..184e5f8 --- /dev/null +++ b/algorithm/src/bj2588.java @@ -0,0 +1,2 @@ +package PACKAGE_NAME;public class bj2588 { +} From 42260bf16c28f00918f5fadb56409b50551caf49 Mon Sep 17 00:00:00 2001 From: wlxorjs2 Date: Sat, 19 Aug 2023 23:40:08 +0900 Subject: [PATCH 02/10] [Solve] BJ1373 --- algorithm/src/BJ1373.java | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 algorithm/src/BJ1373.java diff --git a/algorithm/src/BJ1373.java b/algorithm/src/BJ1373.java new file mode 100644 index 0000000..0c07b49 --- /dev/null +++ b/algorithm/src/BJ1373.java @@ -0,0 +1,2 @@ +package PACKAGE_NAME;public class BJ1373 { +} From 8d41bbeed2b0936996033347b913d2c58992b0b5 Mon Sep 17 00:00:00 2001 From: wlxorjs2 Date: Sat, 19 Aug 2023 23:57:52 +0900 Subject: [PATCH 03/10] [Solve]BJ1373 --- algorithm/.idea/misc.xml | 1 - algorithm/src/BJ1373.java | 31 +++++++++++++++++++++++++++++-- algorithm/src/bj2588.java | 19 ++++++++++++++++++- 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/algorithm/.idea/misc.xml b/algorithm/.idea/misc.xml index cf9abe6..b95853c 100644 --- a/algorithm/.idea/misc.xml +++ b/algorithm/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/algorithm/src/BJ1373.java b/algorithm/src/BJ1373.java index 0c07b49..fb628e1 100644 --- a/algorithm/src/BJ1373.java +++ b/algorithm/src/BJ1373.java @@ -1,2 +1,29 @@ -package PACKAGE_NAME;public class BJ1373 { -} +import java.util.Scanner; +public class BJ1373 { + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + String a = in.nextLine(); + int size = a.length(); + if(size%3==1) + a = "00" + a; + if(size%3==2) + a = "0" + a; + + StringBuilder b = new StringBuilder(); + + int q = 0; + int w = 0; + int e; + + for (int i = 0; i <= a.length()-1; i++){ + int num = a.charAt(i)-'0'; + if(i%3==0) q = num*4; + else if(i%3==1) w = num*2; + else { + e = num; + b.append(q+w+e); + } + } + System.out.println(b); + } +} \ No newline at end of file diff --git a/algorithm/src/bj2588.java b/algorithm/src/bj2588.java index 184e5f8..50e3569 100644 --- a/algorithm/src/bj2588.java +++ b/algorithm/src/bj2588.java @@ -1,2 +1,19 @@ -package PACKAGE_NAME;public class bj2588 { +import java.util.Scanner; +public class bj2588 { + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + + int a = in.nextInt(); + int b = in.nextInt(); + + int sum = 0; + int dap = a * b; + + for(int i = 0; i < 3; i++) { + sum = (b % 10) * a; + System.out.println(sum); + b /= 10; + } + System.out.println(dap); + } } From d581159755f180ff2d64955603481ec0f91ee9a6 Mon Sep 17 00:00:00 2001 From: wlxorjs2 Date: Wed, 30 Aug 2023 19:53:26 +0900 Subject: [PATCH 04/10] [Solve] BJ1009 --- algorithm/src/BJ1009.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 algorithm/src/BJ1009.java diff --git a/algorithm/src/BJ1009.java b/algorithm/src/BJ1009.java new file mode 100644 index 0000000..9c4dbdf --- /dev/null +++ b/algorithm/src/BJ1009.java @@ -0,0 +1,22 @@ +import java.util.Scanner; + +public class BJ1009 { + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + int t = in.nextInt(); //반복 횟수 + int a, b, c; + + for(int i = 0; i < t; i++) { + a = in.nextInt(); + b = in.nextInt(); + c = 1; + + for(int j = 0; j < b; j++){ + c = (c * a) % 10; + if (c == 0) + c = 10; + } + System.out.println(c); + } + } +} From 4745d4a59a9e5793eb899d0b5b27882e9b700573 Mon Sep 17 00:00:00 2001 From: wlxorjs2 Date: Wed, 30 Aug 2023 20:45:04 +0900 Subject: [PATCH 05/10] [Solve] BJ2921 --- algorithm/src/BJ2921.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 algorithm/src/BJ2921.java diff --git a/algorithm/src/BJ2921.java b/algorithm/src/BJ2921.java new file mode 100644 index 0000000..fb5d645 --- /dev/null +++ b/algorithm/src/BJ2921.java @@ -0,0 +1,18 @@ +import java.util.Scanner; +public class BJ2921 { + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + int N = in.nextInt(); + int a = 3; + int b = 6; + int m = 0; + int sum = 0; + for (int i = 0; i < N; i++) { + m = a; + sum += m; + a += b; + b += 3; + } + System.out.println(sum); + } +} From f0fef12832069084009e1188d153d6999f61cdfb Mon Sep 17 00:00:00 2001 From: wlxorjs2 Date: Thu, 31 Aug 2023 00:02:34 +0900 Subject: [PATCH 06/10] [Solve] BJ2839 --- algorithm/src/BJ2839.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 algorithm/src/BJ2839.java diff --git a/algorithm/src/BJ2839.java b/algorithm/src/BJ2839.java new file mode 100644 index 0000000..8850e1f --- /dev/null +++ b/algorithm/src/BJ2839.java @@ -0,0 +1,20 @@ +import java.util.Scanner; + +public class BJ2839 { + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + int N = in.nextInt(); + int sum = 0; + while(true) { + if(N % 5 == 0) { + System.out.println(N / 5 + sum); + break; + } else if (N < 0){ + System.out.println(-1); + break; + } + N = N - 3; + sum++; + } + } +} From 9d9ddbb79269ea23b05cec94527708f197b0a663 Mon Sep 17 00:00:00 2001 From: wlxorjs2 Date: Thu, 31 Aug 2023 00:59:28 +0900 Subject: [PATCH 07/10] [Solve] BJ1934 --- algorithm/src/BJ1934.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 algorithm/src/BJ1934.java diff --git a/algorithm/src/BJ1934.java b/algorithm/src/BJ1934.java new file mode 100644 index 0000000..3c4725f --- /dev/null +++ b/algorithm/src/BJ1934.java @@ -0,0 +1,21 @@ +import java.util.Scanner; + +public class BJ1934 { + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + int t = in.nextInt(); + int d = 0; + for (int i = 0; i < t; i++) { + int a = in.nextInt(); + int b = in.nextInt(); + d = a * b; + int c; + while (b != 0) { + c = a % b; + a = b; + b = c; + } + System.out.println(d/a); + } + } +} From fa7892feb6cee66f46ec5dc2f3455f8fa9e84e6b Mon Sep 17 00:00:00 2001 From: wlxorjs2 Date: Thu, 31 Aug 2023 02:13:24 +0900 Subject: [PATCH 08/10] [Solve] BJ1212 --- algorithm/src/BJ1212.java | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 algorithm/src/BJ1212.java diff --git a/algorithm/src/BJ1212.java b/algorithm/src/BJ1212.java new file mode 100644 index 0000000..7f46cb8 --- /dev/null +++ b/algorithm/src/BJ1212.java @@ -0,0 +1,27 @@ +import java.util.Scanner; + +public class BJ1212 { + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + String a = in.nextLine(); + StringBuilder b = new StringBuilder(); +//객체를 생성하는 것이 아니라 기존의 데이터에 더하는 방식을 사용하여 속도가 빠르다고 한다. + for (int i = 0; i < a.length(); i++){ //입력된 값의 크기만큼 반복 + char c = a.charAt(i); //a의 i번째 글자에 차례에 순서대로 갑니다. + switch (c) { // b.append(3 "011", 1 "001", 4 "100") 더해줌 + case '0': b.append("000"); break; + case '1': b.append("001"); break; + case '2': b.append("010"); break; + case '3': b.append("011"); break; + case '4': b.append("100"); break; + case '5': b.append("101"); break; + case '6': b.append("110"); break; + case '7': b.append("111"); break; + default: break; + } + } + if (b.charAt(0)=='0') b.deleteCharAt(0); + if (b.charAt(0)=='0') b.deleteCharAt(0); + System.out.println(b); + } +} From bdba150a8a798f18a14583a64ccab96205857925 Mon Sep 17 00:00:00 2001 From: wlxorjs2 Date: Thu, 31 Aug 2023 02:54:21 +0900 Subject: [PATCH 09/10] [Solve] BJ1789 --- algorithm/src/BJ1789.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 algorithm/src/BJ1789.java diff --git a/algorithm/src/BJ1789.java b/algorithm/src/BJ1789.java new file mode 100644 index 0000000..3379492 --- /dev/null +++ b/algorithm/src/BJ1789.java @@ -0,0 +1,18 @@ +import java.util.Scanner; + +public class BJ1789 { + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + long a = in.nextLong(); + //자바 int는 21억정도까지 밖에 안됨 + //그러나 문제는 42억까지 요구함 + long sum = 0; + int count = 0; + for(int i = 1; ; i++) { + if(sum > a) break; + count++; + sum += i; + } + System.out.println(count-1); + } +} From d269b00471bd6cf99f2dc94f194c76f73172d012 Mon Sep 17 00:00:00 2001 From: wlxorjs2 Date: Tue, 5 Sep 2023 01:51:23 +0900 Subject: [PATCH 10/10] [Solve] BJ1978 --- algorithm/src/BJ1978.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 algorithm/src/BJ1978.java diff --git a/algorithm/src/BJ1978.java b/algorithm/src/BJ1978.java new file mode 100644 index 0000000..5c5831f --- /dev/null +++ b/algorithm/src/BJ1978.java @@ -0,0 +1,21 @@ +import java.util.Scanner; +public class BJ1978 { + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + int N = in.nextInt(); + int[] a = new int[N]; + int sum = 0; + for (int i = 0; i < a.length; i++) { + a[i] = in.nextInt(); + for(int j = 2; j <= a[i]; j++) { + if(j == a[i]){ + sum++; + } + if (a[i] % j == 0) { + break; + } + } + } + System.out.println(sum); + } +} \ No newline at end of file