From b1f7baf44a9203bcf9184cb9fa270064c27e7043 Mon Sep 17 00:00:00 2001 From: syamauchi Date: Tue, 27 Jun 2023 13:31:14 +0900 Subject: [PATCH 01/11] test commit --- .classpath | 8 ++++++++ .gitignore | 1 + .project | 17 +++++++++++++++++ syamauchi/src/C097_GiftPlan.java | 0 4 files changed, 26 insertions(+) create mode 100644 .classpath create mode 100644 .gitignore create mode 100644 .project create mode 100644 syamauchi/src/C097_GiftPlan.java diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..862b879 --- /dev/null +++ b/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ae3c172 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/.project b/.project new file mode 100644 index 0000000..9d211bd --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + paiza + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/syamauchi/src/C097_GiftPlan.java b/syamauchi/src/C097_GiftPlan.java new file mode 100644 index 0000000..e69de29 -- GitLab From 215a8d958c9429288b46ca5f6d01610bd229b852 Mon Sep 17 00:00:00 2001 From: syamauchi Date: Tue, 27 Jun 2023 14:18:36 +0900 Subject: [PATCH 02/11] =?UTF-8?q?=E5=95=8F=E9=A1=8CC=5F097=E3=81=AE?= =?UTF-8?q?=E5=9B=9E=E7=AD=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- syamauchi/src/C097_GiftPlan.java | 0 syamauchi/src/paiza/C097_GiftPlan.java | 35 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) delete mode 100644 syamauchi/src/C097_GiftPlan.java create mode 100644 syamauchi/src/paiza/C097_GiftPlan.java diff --git a/syamauchi/src/C097_GiftPlan.java b/syamauchi/src/C097_GiftPlan.java deleted file mode 100644 index e69de29..0000000 diff --git a/syamauchi/src/paiza/C097_GiftPlan.java b/syamauchi/src/paiza/C097_GiftPlan.java new file mode 100644 index 0000000..97dca56 --- /dev/null +++ b/syamauchi/src/paiza/C097_GiftPlan.java @@ -0,0 +1,35 @@ +package paiza; + +import java.util.Scanner; + +public class C097_GiftPlan { + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + final int Applicant = sc.nextInt(); //応募者 + final int hitA = sc.nextInt(); //プレゼントAの当選倍数 + final int hitB = sc.nextInt(); //プレゼントBの当選倍数 + + for (int i = 1; i <= Applicant; i++) { //応募者ごとに当選判定 + + if (i % hitA == 0 && i % hitB == 0) { //AB両方当選 + + System.out.println("AB"); + + } else if (i % hitA == 0) { //Aだけ当選 + + System.out.println("A"); + + } else if (i % hitB == 0) { //Bだけ当選 + + System.out.println("B"); + + } else { //当選なし + + System.out.println("N"); + } + } + + } + +} -- GitLab From 8c939b2b6cb2cf70b1fe0d17fda4155b50558c43 Mon Sep 17 00:00:00 2001 From: syamauchi Date: Tue, 27 Jun 2023 14:20:33 +0900 Subject: [PATCH 03/11] =?UTF-8?q?=E5=95=8F=E9=A1=8CC=5F097=E3=81=AE?= =?UTF-8?q?=E5=9B=9E=E7=AD=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- syamauchi/src/C097_GiftPlan.java | 0 syamauchi/src/paiza/C097_GiftPlan.java | 35 -------------------------- 2 files changed, 35 deletions(-) create mode 100644 syamauchi/src/C097_GiftPlan.java delete mode 100644 syamauchi/src/paiza/C097_GiftPlan.java diff --git a/syamauchi/src/C097_GiftPlan.java b/syamauchi/src/C097_GiftPlan.java new file mode 100644 index 0000000..e69de29 diff --git a/syamauchi/src/paiza/C097_GiftPlan.java b/syamauchi/src/paiza/C097_GiftPlan.java deleted file mode 100644 index 97dca56..0000000 --- a/syamauchi/src/paiza/C097_GiftPlan.java +++ /dev/null @@ -1,35 +0,0 @@ -package paiza; - -import java.util.Scanner; - -public class C097_GiftPlan { - - public static void main(String[] args) { - Scanner sc = new Scanner(System.in); - final int Applicant = sc.nextInt(); //応募者 - final int hitA = sc.nextInt(); //プレゼントAの当選倍数 - final int hitB = sc.nextInt(); //プレゼントBの当選倍数 - - for (int i = 1; i <= Applicant; i++) { //応募者ごとに当選判定 - - if (i % hitA == 0 && i % hitB == 0) { //AB両方当選 - - System.out.println("AB"); - - } else if (i % hitA == 0) { //Aだけ当選 - - System.out.println("A"); - - } else if (i % hitB == 0) { //Bだけ当選 - - System.out.println("B"); - - } else { //当選なし - - System.out.println("N"); - } - } - - } - -} -- GitLab From 378d6dedf11d1c26e4df552fb4011f5c46e015cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=B1=E5=86=85=20=E5=BD=A9=E5=9C=9F?= Date: Tue, 27 Jun 2023 05:42:09 +0000 Subject: [PATCH 04/11] Delete .project --- .project | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 .project diff --git a/.project b/.project deleted file mode 100644 index 9d211bd..0000000 --- a/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - paiza - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - -- GitLab From 6b9a9db743e6dfd22982632e0e8d63310411340d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=B1=E5=86=85=20=E5=BD=A9=E5=9C=9F?= Date: Tue, 27 Jun 2023 05:42:15 +0000 Subject: [PATCH 05/11] Delete .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index ae3c172..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/bin/ -- GitLab From 29a5a8a75b2f0f0dfa3b3d45e0f2d1fc9d4bb5f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=B1=E5=86=85=20=E5=BD=A9=E5=9C=9F?= Date: Tue, 27 Jun 2023 05:42:20 +0000 Subject: [PATCH 06/11] Delete .classpath --- .classpath | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .classpath diff --git a/.classpath b/.classpath deleted file mode 100644 index 862b879..0000000 --- a/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - -- GitLab From a48e37910e5492f542ed5fb1f450f6a58e56b4c8 Mon Sep 17 00:00:00 2001 From: syamauchi Date: Tue, 27 Jun 2023 15:51:57 +0900 Subject: [PATCH 07/11] =?UTF-8?q?C=5F097=E5=9B=9E=E7=AD=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- syamauchi/src/C097_GiftPlan.java | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/syamauchi/src/C097_GiftPlan.java b/syamauchi/src/C097_GiftPlan.java index e69de29..97dca56 100644 --- a/syamauchi/src/C097_GiftPlan.java +++ b/syamauchi/src/C097_GiftPlan.java @@ -0,0 +1,35 @@ +package paiza; + +import java.util.Scanner; + +public class C097_GiftPlan { + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + final int Applicant = sc.nextInt(); //応募者 + final int hitA = sc.nextInt(); //プレゼントAの当選倍数 + final int hitB = sc.nextInt(); //プレゼントBの当選倍数 + + for (int i = 1; i <= Applicant; i++) { //応募者ごとに当選判定 + + if (i % hitA == 0 && i % hitB == 0) { //AB両方当選 + + System.out.println("AB"); + + } else if (i % hitA == 0) { //Aだけ当選 + + System.out.println("A"); + + } else if (i % hitB == 0) { //Bだけ当選 + + System.out.println("B"); + + } else { //当選なし + + System.out.println("N"); + } + } + + } + +} -- GitLab From 39c9fc4cfec66925342d79b5f40e634d4e853d57 Mon Sep 17 00:00:00 2001 From: syamauchi Date: Wed, 28 Jun 2023 08:56:31 +0900 Subject: [PATCH 08/11] =?UTF-8?q?C097=E5=95=8F=E9=A1=8C=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- syamauchi/src/C097_GiftPlan.java | 46 +++++++++++++++++++------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/syamauchi/src/C097_GiftPlan.java b/syamauchi/src/C097_GiftPlan.java index 97dca56..b0bdb9a 100644 --- a/syamauchi/src/C097_GiftPlan.java +++ b/syamauchi/src/C097_GiftPlan.java @@ -1,35 +1,43 @@ -package paiza; +package src; import java.util.Scanner; public class C097_GiftPlan { + static Scanner sc = new Scanner(System.in); + static int applicant = sc.nextInt(); // 応募者数の取得 + static int hitA = sc.nextInt(); // プレゼントAの当選倍数 + static int hitB = sc.nextInt(); // プレゼントBの当選倍数 public static void main(String[] args) { - Scanner sc = new Scanner(System.in); - final int Applicant = sc.nextInt(); //応募者 - final int hitA = sc.nextInt(); //プレゼントAの当選倍数 - final int hitB = sc.nextInt(); //プレゼントBの当選倍数 - - for (int i = 1; i <= Applicant; i++) { //応募者ごとに当選判定 - - if (i % hitA == 0 && i % hitB == 0) { //AB両方当選 - + + // 判定実施 + new C097_GiftPlan(hitA, hitB).evaluate(applicant); + } + + private C097_GiftPlan(int hitA, int hitB) { + this.hitA = hitA; + this.hitB = hitB; + } + + private void evaluate(final int applicant) { + for (int i = 1; i <= applicant; i++) { + if (isElectedForPresentA(i) && isElectedForPresentB(i)) { System.out.println("AB"); - - } else if (i % hitA == 0) { //Aだけ当選 - + } else if (isElectedForPresentA(i)) { System.out.println("A"); - - } else if (i % hitB == 0) { //Bだけ当選 - + } else if (isElectedForPresentB(i)) { System.out.println("B"); - - } else { //当選なし - + } else { System.out.println("N"); } } + } + private boolean isElectedForPresentA(final int i) { + return (i % this.hitA == 0); } + private boolean isElectedForPresentB(final int i) { + return (i % this.hitB == 0); + } } -- GitLab From b1ae8a1a2daf0074d8ddfba9697d961328858eda Mon Sep 17 00:00:00 2001 From: syamauchi Date: Wed, 28 Jun 2023 09:03:35 +0900 Subject: [PATCH 09/11] =?UTF-8?q?C097=E3=82=A4=E3=83=B3=E3=83=87=E3=83=B3?= =?UTF-8?q?=E3=83=88=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- syamauchi/src/C097_GiftPlan.java | 48 +++++++++++++++++++------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/syamauchi/src/C097_GiftPlan.java b/syamauchi/src/C097_GiftPlan.java index 97dca56..ec04d9c 100644 --- a/syamauchi/src/C097_GiftPlan.java +++ b/syamauchi/src/C097_GiftPlan.java @@ -1,35 +1,45 @@ -package paiza; +package src; import java.util.Scanner; public class C097_GiftPlan { + static Scanner sc = new Scanner(System.in); + static int applicant = sc.nextInt(); // 応募者数の取得 + static int hitA = sc.nextInt(); // プレゼントAの当選倍数 + static int hitB = sc.nextInt(); // プレゼントBの当選倍数 public static void main(String[] args) { - Scanner sc = new Scanner(System.in); - final int Applicant = sc.nextInt(); //応募者 - final int hitA = sc.nextInt(); //プレゼントAの当選倍数 - final int hitB = sc.nextInt(); //プレゼントBの当選倍数 - - for (int i = 1; i <= Applicant; i++) { //応募者ごとに当選判定 - - if (i % hitA == 0 && i % hitB == 0) { //AB両方当選 - + + + + // 判定実施 + new C097_GiftPlan(hitA, hitB).evaluate(applicant); + } + + private C097_GiftPlan(int hitA, int hitB) { + this.hitA = hitA; + this.hitB = hitB; + } + + private void evaluate(final int applicant) { + for (int i = 1; i <= applicant; i++) { + if (isElectedForPresentA(i) && isElectedForPresentB(i)) { System.out.println("AB"); - - } else if (i % hitA == 0) { //Aだけ当選 - + } else if (isElectedForPresentA(i)) { System.out.println("A"); - - } else if (i % hitB == 0) { //Bだけ当選 - + } else if (isElectedForPresentB(i)) { System.out.println("B"); - - } else { //当選なし - + } else { System.out.println("N"); } } + } + private boolean isElectedForPresentA(final int i) { + return (i % this.hitA == 0); } + private boolean isElectedForPresentB(final int i) { + return (i % this.hitB == 0); + } } -- GitLab From 257435b455f072af2b8ea5626ce911c8bb850b58 Mon Sep 17 00:00:00 2001 From: syamauchi Date: Wed, 28 Jun 2023 09:39:37 +0900 Subject: [PATCH 10/11] =?UTF-8?q?C097=E5=95=8F=E9=A1=8C=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- syamauchi/src/C097_GiftPlan.java | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/syamauchi/src/C097_GiftPlan.java b/syamauchi/src/C097_GiftPlan.java index b0bdb9a..b260e2c 100644 --- a/syamauchi/src/C097_GiftPlan.java +++ b/syamauchi/src/C097_GiftPlan.java @@ -3,22 +3,23 @@ package src; import java.util.Scanner; public class C097_GiftPlan { - static Scanner sc = new Scanner(System.in); - static int applicant = sc.nextInt(); // 応募者数の取得 - static int hitA = sc.nextInt(); // プレゼントAの当選倍数 - static int hitB = sc.nextInt(); // プレゼントBの当選倍数 + private final int hitA; + private final int hitB; - public static void main(String[] args) { + private C097_GiftPlan(final int hitA, final int hitB) { + this.hitA = hitA; + this.hitB = hitB; + } + public static void main(String[] args) { + final Scanner sc = new Scanner(System.in); + final int applicant = sc.nextInt(); // 応募者数の取得 + final int hitA = sc.nextInt(); // プレゼントAの当選倍数 + final int hitB = sc.nextInt(); // プレゼントBの当選倍数 // 判定実施 new C097_GiftPlan(hitA, hitB).evaluate(applicant); } - private C097_GiftPlan(int hitA, int hitB) { - this.hitA = hitA; - this.hitB = hitB; - } - private void evaluate(final int applicant) { for (int i = 1; i <= applicant; i++) { if (isElectedForPresentA(i) && isElectedForPresentB(i)) { @@ -34,10 +35,10 @@ public class C097_GiftPlan { } private boolean isElectedForPresentA(final int i) { - return (i % this.hitA == 0); + return i % this.hitA == 0; } private boolean isElectedForPresentB(final int i) { - return (i % this.hitB == 0); + return i % this.hitB == 0; } } -- GitLab From ecac9f9c5a7cbb0dbb5c40ce3ad7d8db02112098 Mon Sep 17 00:00:00 2001 From: syamauchi Date: Wed, 28 Jun 2023 09:42:59 +0900 Subject: [PATCH 11/11] =?UTF-8?q?C097=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- syamauchi/src/C097_GiftPlan.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/syamauchi/src/C097_GiftPlan.java b/syamauchi/src/C097_GiftPlan.java index b260e2c..5919f9c 100644 --- a/syamauchi/src/C097_GiftPlan.java +++ b/syamauchi/src/C097_GiftPlan.java @@ -14,10 +14,9 @@ public class C097_GiftPlan { public static void main(String[] args) { final Scanner sc = new Scanner(System.in); final int applicant = sc.nextInt(); // 応募者数の取得 - final int hitA = sc.nextInt(); // プレゼントAの当選倍数 - final int hitB = sc.nextInt(); // プレゼントBの当選倍数 + // 判定実施 - new C097_GiftPlan(hitA, hitB).evaluate(applicant); + new C097_GiftPlan(sc.nextInt(), sc.nextInt()).evaluate(applicant); } private void evaluate(final int applicant) { -- GitLab