initial
This commit is contained in:
6
ECOO_2018/.classpath
Normal file
6
ECOO_2018/.classpath
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
1
ECOO_2018/.gitignore
vendored
Normal file
1
ECOO_2018/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/bin/
|
||||
17
ECOO_2018/.project
Normal file
17
ECOO_2018/.project
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>ECOO_2018</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
11
ECOO_2018/.settings/org.eclipse.jdt.core.prefs
Normal file
11
ECOO_2018/.settings/org.eclipse.jdt.core.prefs
Normal file
@@ -0,0 +1,11 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
30
ECOO_2018/src/Q1.java
Normal file
30
ECOO_2018/src/Q1.java
Normal file
@@ -0,0 +1,30 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Q1 {
|
||||
public static void main(String[] args) {
|
||||
Scanner in = new Scanner(System.in);
|
||||
int num = Integer.parseInt(in.nextLine());
|
||||
String names = "";
|
||||
for(int i = 0; i<num; i++) {
|
||||
String challenger = in.nextLine();
|
||||
int space = challenger.indexOf(" ");
|
||||
if(isChallenger(challenger)) {
|
||||
names += challenger.substring(0, space) + " ";
|
||||
}
|
||||
}
|
||||
String[] namesSplit = names.split(" ");
|
||||
for(int j =0; j<namesSplit.length; j++) {
|
||||
System.out.println(namesSplit[j]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean isChallenger(String challenger) {
|
||||
int space = challenger.indexOf(" ");
|
||||
|
||||
if(Integer.parseInt(challenger.substring(space+1)) > 9001){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
32
ECOO_2018/src/Q3.java
Normal file
32
ECOO_2018/src/Q3.java
Normal file
@@ -0,0 +1,32 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Q3 {
|
||||
public static String sRemoved;
|
||||
public static String removed;
|
||||
public static void main(String[] args) {
|
||||
Scanner in = new Scanner(System.in);
|
||||
sRemoved = in.nextLine();
|
||||
|
||||
while(!sRemoved.equals("done")) {
|
||||
removed += scan(sRemoved);
|
||||
}
|
||||
System.out.println(removed);
|
||||
|
||||
}
|
||||
public static String scan(String s) {
|
||||
|
||||
if(s.indexOf(":") != -1) {
|
||||
if(s.substring(s.indexOf(":" + 1)).indexOf(":") != -1){
|
||||
return s.substring(s.indexOf(":"), s.substring(s.indexOf(":" + 1)).indexOf(":"));
|
||||
}
|
||||
}
|
||||
sRemoved = "done";
|
||||
return "";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
40
ECOO_2018/src/Q4.java
Normal file
40
ECOO_2018/src/Q4.java
Normal file
@@ -0,0 +1,40 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Q4 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
//Integer.parseInt(s)
|
||||
Scanner in = new Scanner(System.in);
|
||||
|
||||
int num = Integer.parseInt(in.nextLine());
|
||||
String input = in.nextLine();
|
||||
String[] inputs = input.split(" ");
|
||||
int greatest = 0;
|
||||
|
||||
int regScore = 0;
|
||||
for(int i=0;i<inputs.length - 1;i+=2) {
|
||||
if(getHandValue(inputs, i) > greatest) {
|
||||
greatest = getHandValue(inputs, i);
|
||||
}
|
||||
}
|
||||
System.out.println(greatest);
|
||||
}
|
||||
|
||||
public static int getHandValue(String[] hand, int pairIndex) {
|
||||
int value = 0;
|
||||
for(int j = 0; j<pairIndex; j+=2) {
|
||||
value+=Integer.parseInt(hand[j]);
|
||||
}
|
||||
value += Integer.parseInt(hand[pairIndex]) + Integer.parseInt(hand[pairIndex + 1]);
|
||||
|
||||
|
||||
for(int j = pairIndex + 3; j<hand.length; j+=2) {
|
||||
value+=Integer.parseInt(hand[j]);
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user