This commit is contained in:
jslightham
2020-02-12 10:46:48 -05:00
parent ca63a62844
commit 7570e486df
22 changed files with 91 additions and 1 deletions

View 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
CCC_2019 Junior/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/bin/

17
CCC_2019 Junior/.project Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>CCC_2019 Junior</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>

View 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

View File

@@ -0,0 +1,43 @@
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static int[] top = new int[] {1, 2};
public static int[] bottom = new int[] {3, 4};
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String input = in.nextLine();
String[] inputArr = input.split("");
for(int i =0; i<inputArr.length; i++) {
if(inputArr[i].equals("V")) {
vFlip();
}
if(inputArr[i].equals("H")) {
hFlip();
}
}
print();
}
public static void hFlip() {
int temp1 = top[0];
int temp2 = top[1];
top[0] = bottom[0];
top[1] = bottom[1];
bottom[0] = temp1;
bottom[1] = temp2;
}
public static void vFlip() {
int temp1 = top[0];
int temp2 = bottom[0];
top[0] = top[1];
bottom[0] = bottom[1];
top[1] = temp1;
bottom[1] = temp2;
}
public static void print() {
System.out.println(top[0] + " " + top[1]);
System.out.println(bottom[0] + " " + bottom[1]);
}
}

View File

@@ -0,0 +1,23 @@
import java.util.Scanner;
public class Q1 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a1 = in.nextInt();
int a2 = in.nextInt();
int a3 = in.nextInt();
int appleScore = a1*3 + a2*2 + a3*1;
int b1 = in.nextInt();
int b2 = in.nextInt();
int b3 = in.nextInt();
int bananaScore = b1*3 + b2*2 + b3*1;
if(appleScore > bananaScore) {
System.out.println("A");
}else if(bananaScore > appleScore) {
System.out.println("B");
}else {
System.out.println("T");
}
}
}

View File

@@ -0,0 +1,16 @@
import java.util.Scanner;
public class Q2 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int numInputs = Integer.parseInt(in.nextLine());
for(int i =0; i<numInputs; i++) {
String temp = in.nextLine();
int numTimes = Integer.parseInt(temp.substring(0, temp.indexOf(" ")));
for(int j = 0; j<numTimes; j++) {
System.out.print(temp.substring(temp.indexOf(" ")));
}
}
}
}

View File

@@ -0,0 +1,41 @@
import java.util.Scanner;
public class Q3 {
public static String ret = "";
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int numInputs = Integer.parseInt(in.nextLine());
for(int i = 0; i<numInputs; i++) {
String temp = in.nextLine();
while(!temp.equals("")) {
temp = remove(temp);
}
System.out.println(ret);
ret = "";
}
}
public static String remove(String temp) {
int lastIndex = getLastIndex(temp);
String firstPart = temp.substring(0, lastIndex + 1);
ret += firstPart.length() + " " + temp.substring(0, 1) + " ";
return temp.substring(firstPart.length());
}
public static int getLastIndex(String str) {
String target = str.substring(0, 1);
for(int i = 0; i<str.length(); i++) {
if(str.substring(i, i+1).equals(target)) {
}else if(str.length() == i) {
return str.length() - 1;
}
else {
return i - 1;
}
}
return str.length() - 1;
}
}

View File

@@ -0,0 +1,43 @@
import java.util.Scanner;
public class Q4 {
public static int[] top = new int[] {1, 2};
public static int[] bottom = new int[] {3, 4};
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String input = in.nextLine();
String[] inputArr = input.split("");
for(int i =0; i<inputArr.length; i++) {
if(inputArr[i].equals("V")) {
vFlip();
}
if(inputArr[i].equals("H")) {
hFlip();
}
}
print();
}
public static void hFlip() {
int temp1 = top[0];
int temp2 = top[1];
top[0] = bottom[0];
top[1] = bottom[1];
bottom[0] = temp1;
bottom[1] = temp2;
}
public static void vFlip() {
int temp1 = top[0];
int temp2 = bottom[0];
top[0] = top[1];
bottom[0] = bottom[1];
top[1] = temp1;
bottom[1] = temp2;
}
public static void print() {
System.out.println(top[0] + " " + top[1]);
System.out.println(bottom[0] + " " + bottom[1]);
}
}

View File

@@ -0,0 +1,54 @@
import java.util.ArrayList;
import java.util.Scanner;
public class Q5 {
public static int ruleNum = 0;
public static String ret;
public static ArrayList<String> rules = new ArrayList<String>();
public static ArrayList<String> rules2 = new ArrayList<String>();
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int s = 0;
String initial = "", finish = "";
String temp = "";
boolean isFinished = false;
while(!isFinished) {
temp = in.nextLine();
try {
s = Integer.parseInt(temp.substring(0, temp.indexOf(" ")));
initial = temp.substring(temp.indexOf(" ") + 1, temp.indexOf(" ", temp.indexOf(" ")+1));
finish = temp.substring(temp.indexOf(" ", temp.indexOf(" ") + 1) + 1);
isFinished = true;
}catch(Exception e){
rules.add(temp.substring(0, temp.indexOf(" ")));
rules2.add(temp.substring(temp.indexOf(" ") +1));
}
}
ret = initial;
completeNext();
for(int i = 0; i<initial.length(); i++) {
}
System.out.println(s);
System.out.println(initial);
System.out.println(finish);
System.out.println(rules);
System.out.println(rules2);
System.out.println(ret);
}
public static int completeNext() {
for(int j = 0; j<rules.size(); j++) {
if(ret.contains(rules.get(j))) {
ret = ret.substring(0, ret.indexOf(rules.get(j))) + ret.substring(ret.indexOf(rules.get(j)) + rules.get(j).length());
}
}
return 0;
}
}