From 9d60293b502654d741f48289d0f73885bc7cc6a1 Mon Sep 17 00:00:00 2001 From: Eduardo Martinez Date: Tue, 20 Dec 2022 17:26:29 -0600 Subject: [PATCH 1/2] d1000000 - Java --- solutions/d1000000/Dice.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 solutions/d1000000/Dice.java diff --git a/solutions/d1000000/Dice.java b/solutions/d1000000/Dice.java new file mode 100644 index 00000000..24c8e951 --- /dev/null +++ b/solutions/d1000000/Dice.java @@ -0,0 +1,23 @@ +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Scanner; +public class Dice{ + static Scanner inputObject = new Scanner(System.in); //Scaner for the input + public static void main(String[] args) { + int T = inputObject.nextInt(); //Read T = Number of cases + for(int i = 1; i <= T; i++){//Iterate through all the cases + int N = inputObject.nextInt();//Read N = Length of dice list + List S = new ArrayList(); + for(int j = 0; j < N; j++){//Read the list of dice + S.add(inputObject.nextInt()); + } + Collections.sort(S); //Sort the list + int length = 0;//Length of the straight + for(int j =0; j length) length++; //Add +1 to the length if the die size is bigger that the actual length + } + System.out.println("Case #" + i + ": " + length); //Print the length of the straight + } + } +} \ No newline at end of file From 0def0606f7ce3626ef8830a7a31266dff7c8d446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Isai=20Mart=C3=ADnez=20M=C3=A9ndez?= <44093701+EduardoMtz1@users.noreply.github.com> Date: Fri, 23 Dec 2022 16:51:54 -0600 Subject: [PATCH 2/2] Rename: d1000000.java --- solutions/d1000000/{Dice.java => d1000000.java} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename solutions/d1000000/{Dice.java => d1000000.java} (97%) diff --git a/solutions/d1000000/Dice.java b/solutions/d1000000/d1000000.java similarity index 97% rename from solutions/d1000000/Dice.java rename to solutions/d1000000/d1000000.java index 24c8e951..245609d4 100644 --- a/solutions/d1000000/Dice.java +++ b/solutions/d1000000/d1000000.java @@ -2,7 +2,7 @@ import java.util.Collections; import java.util.List; import java.util.Scanner; -public class Dice{ +public class d1000000{ static Scanner inputObject = new Scanner(System.in); //Scaner for the input public static void main(String[] args) { int T = inputObject.nextInt(); //Read T = Number of cases @@ -20,4 +20,4 @@ public static void main(String[] args) { System.out.println("Case #" + i + ": " + length); //Print the length of the straight } } -} \ No newline at end of file +}