mirror of
https://github.com/Xevion/contest.git
synced 2025-12-10 10:06:53 -06:00
rename aplus october 2013
This commit is contained in:
6
uil/aplus-octoboer-2013/1/java/.idea/misc.xml
generated
Normal file
6
uil/aplus-octoboer-2013/1/java/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
uil/aplus-octoboer-2013/1/java/.idea/modules.xml
generated
Normal file
8
uil/aplus-octoboer-2013/1/java/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/1.iml" filepath="$PROJECT_DIR$/1.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
311
uil/aplus-octoboer-2013/1/java/.idea/workspace.xml
generated
Normal file
311
uil/aplus-octoboer-2013/1/java/.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,311 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="23ea4cb8-4435-47e1-9ce5-e2565ff7e5f3" name="Default Changelist" comment="" />
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FUSProjectUsageTrigger">
|
||||
<session id="132001983">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.closed" value="3" />
|
||||
<entry key="project.open.time.0" value="2" />
|
||||
<entry key="project.open.time.2" value="1" />
|
||||
<entry key="project.opened" value="3" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.open">
|
||||
<counts>
|
||||
<entry key="class" value="1" />
|
||||
<entry key="java" value="2" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.open">
|
||||
<counts>
|
||||
<entry key="CLASS" value="1" />
|
||||
<entry key="JAVA" value="2" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="java" value="571" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="JAVA" value="571" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
</session>
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/problem1.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="329">
|
||||
<caret line="54" column="26" selection-start-line="54" selection-start-column="26" selection-end-line="54" selection-end-column="26" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="GradleLocalSettings">
|
||||
<option name="projectSyncType">
|
||||
<map>
|
||||
<entry key="A:/Programming/Modding/Minecraft/EnderStorage" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/Fabric/fabric-example-mod" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/HelloWorldMod" value="PREVIEW" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/src/problem1.java" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="351" />
|
||||
<option name="y" value="-16" />
|
||||
<option name="width" value="974" />
|
||||
<option name="height" value="1057" />
|
||||
</component>
|
||||
<component name="ProjectView">
|
||||
<navigator proportions="" version="1">
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="Scope" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="1" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="1" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="1" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="1" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="out" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="1" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="1" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="out" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="production" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="1" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="1" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="out" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="production" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="1" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="1" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="1" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1568523089262" />
|
||||
<property name="project.structure.last.edited" value="Modules" />
|
||||
<property name="project.structure.proportion" value="0.0" />
|
||||
<property name="project.structure.side.proportion" value="0.0" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="F:\Programming\Java\UIL\October 2013 Set\1\src" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="problem1" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="problem1" />
|
||||
<module name="1" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.problem1" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="23ea4cb8-4435-47e1-9ce5-e2565ff7e5f3" name="Default Changelist" comment="" />
|
||||
<created>1568522090590</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1568522090590</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
|
||||
<layout>
|
||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2553305" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info id="Image Layers" order="2" />
|
||||
<window_info id="Designer" order="3" />
|
||||
<window_info id="UI Designer" order="4" />
|
||||
<window_info id="Capture Tool" order="5" />
|
||||
<window_info id="Favorites" order="6" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.32939914" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="bottom" id="Terminal" order="7" />
|
||||
<window_info anchor="bottom" id="Event Log" order="8" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Version Control" order="9" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Messages" order="10" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
<window_info anchor="right" id="Palette" order="3" />
|
||||
<window_info anchor="right" id="Capture Analysis" order="4" />
|
||||
<window_info anchor="right" id="Theme Preview" order="5" />
|
||||
<window_info anchor="right" id="Palette	" order="6" />
|
||||
<window_info anchor="right" id="Maven Projects" order="7" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/problem1.class" />
|
||||
<entry file="file://$PROJECT_DIR$/src/problem1.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="329">
|
||||
<caret line="54" column="26" selection-start-line="54" selection-start-column="26" selection-end-line="54" selection-end-column="26" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ArtifactsStructureConfigurable.UI">
|
||||
<settings>
|
||||
<artifact-editor />
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="FacetStructureConfigurable.UI">
|
||||
<settings>
|
||||
<last-edited>No facets are configured</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="GlobalLibrariesConfigurable.UI">
|
||||
<settings>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="JdkListConfigurable.UI">
|
||||
<settings>
|
||||
<last-edited>1.8</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="ModuleStructureConfigurable.UI">
|
||||
<settings>
|
||||
<last-edited>1</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
<option value="0.6" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>11</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="ProjectLibrariesConfigurable.UI">
|
||||
<settings>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
||||
11
uil/aplus-octoboer-2013/1/java/1.iml
Normal file
11
uil/aplus-octoboer-2013/1/java/1.iml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
4
uil/aplus-octoboer-2013/1/java/input1.dat
Normal file
4
uil/aplus-octoboer-2013/1/java/input1.dat
Normal file
@@ -0,0 +1,4 @@
|
||||
3
|
||||
1 2 3 3
|
||||
10 10 10 10 10 10 10 10 10 10
|
||||
2 3 4 5 5 9 8 7 5 5 3 2 1
|
||||
BIN
uil/aplus-octoboer-2013/1/java/out/production/1/problem1.class
Normal file
BIN
uil/aplus-octoboer-2013/1/java/out/production/1/problem1.class
Normal file
Binary file not shown.
85
uil/aplus-octoboer-2013/1/java/src/problem1.java
Normal file
85
uil/aplus-octoboer-2013/1/java/src/problem1.java
Normal file
@@ -0,0 +1,85 @@
|
||||
import static java.lang.System.*;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Collections;
|
||||
import java.util.Scanner;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
public class problem1 {
|
||||
public static void main(String[] args) throws FileNotFoundException {
|
||||
// Main Constants
|
||||
File input = new File("input1.dat");
|
||||
Scanner scan = new Scanner(input);
|
||||
List<String> output = new ArrayList<String>();
|
||||
|
||||
// Process the input data
|
||||
int lineCount = scan.nextInt();
|
||||
scan.nextLine();
|
||||
for(int i = 0; i < lineCount; i++) {
|
||||
output.add(process(scan.nextLine()));
|
||||
}
|
||||
|
||||
// Print out the array of processed inputs
|
||||
output.add(0, "mean median mode");
|
||||
for(String line : output) {
|
||||
out.println(line);
|
||||
}
|
||||
}
|
||||
|
||||
static String process(String input) {
|
||||
// Sub-constants
|
||||
Scanner read = new Scanner(input);
|
||||
int sum = 0;
|
||||
Map<Integer, Integer> mode = new HashMap<Integer, Integer>();
|
||||
List<Integer> median = new ArrayList<Integer>();
|
||||
|
||||
// Read each number in the file in sequence
|
||||
while(read.hasNextInt()) {
|
||||
int newread = read.nextInt();
|
||||
sum += newread;
|
||||
// Add key to dictionary and list
|
||||
median.add(newread);
|
||||
if(mode.containsKey(newread))
|
||||
mode.put(newread, mode.get(newread) + 1);
|
||||
else
|
||||
mode.put(newread, 1);
|
||||
}
|
||||
|
||||
// Find the mean and mode
|
||||
double mean = sum / (double) median.size();
|
||||
double finalMode = getBestKey(mode, median);
|
||||
|
||||
// Find the median
|
||||
Collections.sort(median);
|
||||
double finalMedian;
|
||||
if(median.size() % 2 == 0 && median.size() > 2) {
|
||||
int center = (median.size() / 2) - 1;
|
||||
finalMedian = (median.get(center) + median.get(center + 1)) / 2.0;
|
||||
} else
|
||||
finalMedian = median.get(median.size() / 2);
|
||||
|
||||
return "" + properRound(mean) + " " + properRound(finalMedian) + " " + properRound(finalMode);
|
||||
}
|
||||
|
||||
// Formats the string properly, rounds down to 1 decimal always
|
||||
static String properRound(double input) {
|
||||
return "" + (Math.round(input * 10) / 10.0);
|
||||
}
|
||||
|
||||
// In a dictionary, finds the key with the highest value, for mode
|
||||
// Keys are provided from the list aggregated for the median
|
||||
static int getBestKey(Map<Integer, Integer> map, List<Integer> keys) {
|
||||
int curcount = (Integer) 0;
|
||||
int curkey = (Integer) 0;
|
||||
for(Integer key : keys) {
|
||||
if(map.get(key) > curcount) {
|
||||
curcount = map.get(key);
|
||||
curkey = key;
|
||||
}
|
||||
}
|
||||
return curkey;
|
||||
}
|
||||
}
|
||||
6
uil/aplus-octoboer-2013/10/10/.classpath
Normal file
6
uil/aplus-octoboer-2013/10/10/.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>
|
||||
17
uil/aplus-octoboer-2013/10/10/.project
Normal file
17
uil/aplus-octoboer-2013/10/10/.project
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<projectDescription>
|
||||
<name>10</name>
|
||||
<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>
|
||||
@@ -0,0 +1,7 @@
|
||||
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.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
11
uil/aplus-octoboer-2013/10/10/.vscode/launch.json
vendored
Normal file
11
uil/aplus-octoboer-2013/10/10/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "CodeLens (Launch) - problem10",
|
||||
"request": "launch",
|
||||
"mainClass": "problem10",
|
||||
"projectName": "10"
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
uil/aplus-octoboer-2013/10/10/bin/Synonym.class
Normal file
BIN
uil/aplus-octoboer-2013/10/10/bin/Synonym.class
Normal file
Binary file not shown.
BIN
uil/aplus-octoboer-2013/10/10/bin/SynonymOrganizer.class
Normal file
BIN
uil/aplus-octoboer-2013/10/10/bin/SynonymOrganizer.class
Normal file
Binary file not shown.
BIN
uil/aplus-octoboer-2013/10/10/bin/problem10.class
Normal file
BIN
uil/aplus-octoboer-2013/10/10/bin/problem10.class
Normal file
Binary file not shown.
10
uil/aplus-octoboer-2013/10/10/input.dat
Normal file
10
uil/aplus-octoboer-2013/10/10/input.dat
Normal file
@@ -0,0 +1,10 @@
|
||||
4
|
||||
this paragraph was fun to write i love to write fun assignments
|
||||
having work to do is very fun my favorite subject is english but
|
||||
i also love to write programs which is a close second but not
|
||||
bad this bad assignment was bad bad bad bad and bad
|
||||
4
|
||||
fun diverting festive
|
||||
love enjoy relish
|
||||
write scribe code
|
||||
bad horrible bitter terrible evil base rancid
|
||||
94
uil/aplus-octoboer-2013/10/10/src/problem10.java
Normal file
94
uil/aplus-octoboer-2013/10/10/src/problem10.java
Normal file
@@ -0,0 +1,94 @@
|
||||
import static java.lang.System.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Scanner;
|
||||
|
||||
class Synonym {
|
||||
int index = 0;
|
||||
List<String> synonyms;
|
||||
Synonym(String[] synonyms) {
|
||||
this.synonyms = Arrays.asList(synonyms);
|
||||
}
|
||||
|
||||
String next() {
|
||||
return synonyms.get(this.index++ % synonyms.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SynonymOrganizer {
|
||||
Map<String, Integer> points = new HashMap<String, Integer>();
|
||||
List<Synonym> synonyms = new ArrayList<Synonym>();
|
||||
|
||||
// Takes lines of synonyms
|
||||
SynonymOrganizer(String[] synlines) {
|
||||
int creationIndex = 0;
|
||||
// Iterate over each line and process synonyms
|
||||
for(String line : synlines) {
|
||||
// Get all words in synonym list
|
||||
String[] words = line.split("\\s");
|
||||
for(String word : words) {
|
||||
// Can switch off to using Map<String, ArrayList<Integer>> for multi-value synonyms instead of singular
|
||||
if(points.containsKey(word))
|
||||
out.println("Word \"" + word + "\" already used for previous synonym, overwriting.");
|
||||
points.put(word, creationIndex);
|
||||
}
|
||||
// Add the list of synonyms with new Synonym object
|
||||
synonyms.add(new Synonym(words));
|
||||
// Increment for next pointer
|
||||
creationIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasSynonym(String word) {
|
||||
return points.containsKey(word);
|
||||
}
|
||||
|
||||
// Gets a synonym, increments synonym object index
|
||||
String getSynonym(String word) {
|
||||
// Pointless in a perfect world
|
||||
if(!points.containsKey(word)) {
|
||||
out.println("Word\"" + word + "\"had no synonyms!");
|
||||
}
|
||||
// Retriever integer map pointer, then return next synonym
|
||||
int pointer = points.get(word);
|
||||
return synonyms.get(pointer).next();
|
||||
}
|
||||
}
|
||||
|
||||
public class problem10 {
|
||||
public static void main(String[] args) throws FileNotFoundException {
|
||||
// Initial Constants
|
||||
File input = new File("input.dat");
|
||||
Scanner read = new Scanner(input);
|
||||
|
||||
// Read paragraph lines
|
||||
String[] rawParagraph = new String[Integer.parseInt(read.nextLine())];
|
||||
for(int i = 0; i < rawParagraph.length; i++)
|
||||
rawParagraph[i] = read.nextLine();
|
||||
|
||||
// Read synonym lines
|
||||
String[] synonymLines = new String[Integer.parseInt(read.nextLine())];
|
||||
for(int i = 0; i < synonymLines.length; i++)
|
||||
synonymLines[i] = read.nextLine();
|
||||
|
||||
// Start processing the paragraph
|
||||
SynonymOrganizer organizer = new SynonymOrganizer(synonymLines);
|
||||
for(String line : rawParagraph) {
|
||||
String[] words = line.split("\\s");
|
||||
for(int i = 0; i < words.length; i++) {
|
||||
// Replace if organizer has a synonym
|
||||
if(organizer.hasSynonym(words[i])) {
|
||||
words[i] = organizer.getSynonym(words[i]);
|
||||
}
|
||||
}
|
||||
out.println(String.join(" ", words));
|
||||
}
|
||||
read.close();
|
||||
}
|
||||
}
|
||||
26
uil/aplus-octoboer-2013/11/.vscode/launch.json
vendored
Normal file
26
uil/aplus-octoboer-2013/11/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "CodeLens (Launch) - problem11",
|
||||
"request": "launch",
|
||||
"mainClass": "problem11"
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "CodeLens (Launch) - problem9",
|
||||
"request": "launch",
|
||||
"mainClass": "problem9"
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Debug (Launch) - Current File",
|
||||
"request": "launch",
|
||||
"mainClass": "${file}"
|
||||
}
|
||||
]
|
||||
}
|
||||
3
uil/aplus-octoboer-2013/11/input.dat
Normal file
3
uil/aplus-octoboer-2013/11/input.dat
Normal file
@@ -0,0 +1,3 @@
|
||||
1
|
||||
2
|
||||
3
|
||||
BIN
uil/aplus-octoboer-2013/11/out/production/11/problem11.class
Normal file
BIN
uil/aplus-octoboer-2013/11/out/production/11/problem11.class
Normal file
Binary file not shown.
14
uil/aplus-octoboer-2013/11/src/problem11.java
Normal file
14
uil/aplus-octoboer-2013/11/src/problem11.java
Normal file
@@ -0,0 +1,14 @@
|
||||
import static java.lang.System.*;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class problem11 {
|
||||
public static void main(String[] args) throws FileNotFoundException {
|
||||
File input = new File("input.dat");
|
||||
Scanner read = new Scanner(input);
|
||||
while(read.hasNextInt())
|
||||
out.println(read.nextInt() * 3);
|
||||
read.close();
|
||||
}
|
||||
}
|
||||
6
uil/aplus-octoboer-2013/12/.classpath
Normal file
6
uil/aplus-octoboer-2013/12/.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>
|
||||
6
uil/aplus-octoboer-2013/12/.idea/misc.xml
generated
Normal file
6
uil/aplus-octoboer-2013/12/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/classes" />
|
||||
</component>
|
||||
</project>
|
||||
8
uil/aplus-octoboer-2013/12/.idea/modules.xml
generated
Normal file
8
uil/aplus-octoboer-2013/12/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/12.iml" filepath="$PROJECT_DIR$/12.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
uil/aplus-octoboer-2013/12/.idea/vcs.xml
generated
Normal file
6
uil/aplus-octoboer-2013/12/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
332
uil/aplus-octoboer-2013/12/.idea/workspace.xml
generated
Normal file
332
uil/aplus-octoboer-2013/12/.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,332 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="1fd89a9c-d895-4e45-acab-398cb78a9403" name="Default Changelist" comment="" />
|
||||
<ignored path="$PROJECT_DIR$/bin/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FUSProjectUsageTrigger">
|
||||
<session id="1210997399">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.closed" value="3" />
|
||||
<entry key="project.open.time.4" value="1" />
|
||||
<entry key="project.open.time.5" value="1" />
|
||||
<entry key="project.open.time.6" value="1" />
|
||||
<entry key="project.opened" value="3" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.open">
|
||||
<counts>
|
||||
<entry key="dat" value="1" />
|
||||
<entry key="java" value="3" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.open">
|
||||
<counts>
|
||||
<entry key="JAVA" value="3" />
|
||||
<entry key="PLAIN_TEXT" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="dat" value="127" />
|
||||
<entry key="java" value="2680" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="JAVA" value="2680" />
|
||||
<entry key="PLAIN_TEXT" value="127" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
</session>
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/problem12.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="481">
|
||||
<caret line="158" column="29" selection-start-line="158" selection-start-column="29" selection-end-line="158" selection-end-column="29" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>debug</find>
|
||||
<find>offsets</find>
|
||||
</findStrings>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../../.." />
|
||||
</component>
|
||||
<component name="GradleLocalSettings">
|
||||
<option name="projectSyncType">
|
||||
<map>
|
||||
<entry key="A:/Programming/Modding/Minecraft/EnderStorage" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/Fabric/fabric-example-mod" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/HelloWorldMod" value="PREVIEW" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/input.dat" />
|
||||
<option value="$PROJECT_DIR$/src/problem12.java" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="351" />
|
||||
<option name="y" value="-16" />
|
||||
<option name="width" value="974" />
|
||||
<option name="height" value="1057" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectView">
|
||||
<navigator proportions="" version="1">
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="12" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="12" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="12" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="12" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="12" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="12" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="problem12.java" type="529ef68f:ClassesTreeStructureProvider$PsiClassOwnerTreeNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
<pane id="PackagesPane" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1569034632346" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../../../exercism/java/hello-world" />
|
||||
<property name="project.structure.last.edited" value="Project" />
|
||||
<property name="project.structure.proportion" value="0.15" />
|
||||
<property name="project.structure.side.proportion" value="0.2" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="problem12" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="problem12" />
|
||||
<module name="12" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.problem12" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="1fd89a9c-d895-4e45-acab-398cb78a9403" name="Default Changelist" comment="" />
|
||||
<created>1568926083487</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1568926083487</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TodoView">
|
||||
<todo-panel id="selected-file">
|
||||
<is-autoscroll-to-source value="true" />
|
||||
</todo-panel>
|
||||
<todo-panel id="all">
|
||||
<are-packages-shown value="true" />
|
||||
<is-autoscroll-to-source value="true" />
|
||||
</todo-panel>
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
|
||||
<layout>
|
||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2553305" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info id="Image Layers" order="2" />
|
||||
<window_info id="Designer" order="3" />
|
||||
<window_info id="UI Designer" order="4" />
|
||||
<window_info id="Capture Tool" order="5" />
|
||||
<window_info id="Favorites" order="6" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.32939914" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.39914164" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" weight="0.32939914" />
|
||||
<window_info anchor="bottom" id="Terminal" order="7" />
|
||||
<window_info anchor="bottom" id="Event Log" order="8" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Version Control" order="9" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Messages" order="10" weight="0.32939914" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
<window_info anchor="right" id="Palette" order="3" />
|
||||
<window_info anchor="right" id="Capture Analysis" order="4" />
|
||||
<window_info anchor="right" id="Theme Preview" order="5" />
|
||||
<window_info anchor="right" id="Palette	" order="6" />
|
||||
<window_info anchor="right" id="Maven Projects" order="7" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="jar://C:/Program Files/AdoptOpenJDK/jdk-8.0.212.04-hotspot/src.zip!/com/sun/xml/internal/ws/api/message/HeaderList.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="178">
|
||||
<caret line="112" column="13" selection-start-line="112" selection-start-column="13" selection-end-line="112" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="jar://C:/Program Files/AdoptOpenJDK/jdk-8.0.212.04-hotspot/src.zip!/java/util/ArrayList.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="442">
|
||||
<caret line="444" column="13" selection-start-line="444" selection-start-column="13" selection-end-line="444" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/input.dat">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="221">
|
||||
<caret line="13" column="8" lean-forward="true" selection-start-line="13" selection-start-column="8" selection-end-line="13" selection-end-column="8" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/problem12.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="481">
|
||||
<caret line="158" column="29" selection-start-line="158" selection-start-column="29" selection-end-line="158" selection-end-column="29" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ArtifactsStructureConfigurable.UI">
|
||||
<settings>
|
||||
<artifact-editor />
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="FacetStructureConfigurable.UI">
|
||||
<settings>
|
||||
<last-edited>No facets are configured</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="GlobalLibrariesConfigurable.UI">
|
||||
<settings>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="JdkListConfigurable.UI">
|
||||
<settings>
|
||||
<last-edited>1.8 (2)</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="ModuleStructureConfigurable.UI">
|
||||
<settings>
|
||||
<last-edited>12</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
<option value="0.6" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>11</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="ProjectLibrariesConfigurable.UI">
|
||||
<settings>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
||||
17
uil/aplus-octoboer-2013/12/.project
Normal file
17
uil/aplus-octoboer-2013/12/.project
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<projectDescription>
|
||||
<name>12</name>
|
||||
<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>
|
||||
@@ -0,0 +1,7 @@
|
||||
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.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
11
uil/aplus-octoboer-2013/12/.vscode/launch.json
vendored
Normal file
11
uil/aplus-octoboer-2013/12/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "CodeLens (Launch) - problem12",
|
||||
"request": "launch",
|
||||
"mainClass": "problem12",
|
||||
"projectName": "12"
|
||||
}
|
||||
]
|
||||
}
|
||||
12
uil/aplus-octoboer-2013/12/12.iml
Normal file
12
uil/aplus-octoboer-2013/12/12.iml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<output url="file://$MODULE_DIR$/bin" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
BIN
uil/aplus-octoboer-2013/12/bin/CheckerBoard.class
Normal file
BIN
uil/aplus-octoboer-2013/12/bin/CheckerBoard.class
Normal file
Binary file not shown.
BIN
uil/aplus-octoboer-2013/12/bin/Point.class
Normal file
BIN
uil/aplus-octoboer-2013/12/bin/Point.class
Normal file
Binary file not shown.
BIN
uil/aplus-octoboer-2013/12/bin/problem12.class
Normal file
BIN
uil/aplus-octoboer-2013/12/bin/problem12.class
Normal file
Binary file not shown.
17
uil/aplus-octoboer-2013/12/input.dat
Normal file
17
uil/aplus-octoboer-2013/12/input.dat
Normal file
@@ -0,0 +1,17 @@
|
||||
2
|
||||
B B
|
||||
B B B
|
||||
B B B
|
||||
B B
|
||||
B B R
|
||||
R R R R
|
||||
R R R R
|
||||
R R R
|
||||
B B B B
|
||||
B
|
||||
B B B R
|
||||
R
|
||||
B
|
||||
R R
|
||||
R B R
|
||||
R R R R
|
||||
233
uil/aplus-octoboer-2013/12/src/problem12.java
Normal file
233
uil/aplus-octoboer-2013/12/src/problem12.java
Normal file
@@ -0,0 +1,233 @@
|
||||
import static java.lang.System.*;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
// Point representing and (X, Y) coordinate
|
||||
class Point {
|
||||
String type;
|
||||
int x, y;
|
||||
|
||||
// Untyped Point Constructor
|
||||
Point(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.type = "";
|
||||
}
|
||||
|
||||
// Typed Point Constructor
|
||||
Point(int x, int y, String type) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.type = type.equals(" ") ? "" : type;
|
||||
}
|
||||
|
||||
// Returns a point which is the translated end-point based on the other point (offset).
|
||||
Point merge(Point other) {
|
||||
return new Point(this.x + other.x, this.y + other.y, this.type);
|
||||
}
|
||||
|
||||
// Offsets the point by a Point's (x, y) set
|
||||
void offset(Point other) {
|
||||
this.x += other.x;
|
||||
this.y += other.y;
|
||||
}
|
||||
|
||||
// Point string representation
|
||||
public String toString() {
|
||||
return String.format(
|
||||
"Point(\"%s\", %d, %d)",
|
||||
(this.type.equals("") ? "?" : this.type),
|
||||
this.x,
|
||||
this.y
|
||||
);
|
||||
}
|
||||
|
||||
boolean isEmpty() {
|
||||
return this.type.equals("");
|
||||
}
|
||||
|
||||
// equals() method for testing equality of two Point() objects
|
||||
// positional untyped equality test, see fullEquals()
|
||||
private boolean equals(Point other) {
|
||||
return this.x == other.x && this.y == other.y;
|
||||
}
|
||||
|
||||
// tests equality of x, y and type
|
||||
public boolean fullEquals(Point other) {
|
||||
return this.equals(other) && this.type == other.type;
|
||||
}
|
||||
|
||||
// Returns whether a point could be found in a collection
|
||||
boolean collectionContains(Collection<Point> collection) {
|
||||
for(Point other : collection) {
|
||||
if(this.x == other.x && this.y == other.y) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Class method that searches a List
|
||||
// Returns -1 if item not found in list
|
||||
public int findPoint(List<Point> list) {
|
||||
for(Point other : list) {
|
||||
if(this.x == other.x && this.y == other.y)
|
||||
return list.indexOf(other);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Creates a List of Points based on a primitive int[][] matrix
|
||||
static List<Point> asList(int[][] primitivePoints) {
|
||||
List<Point> points = new ArrayList<Point>();
|
||||
for (int[] primPoint: primitivePoints) {
|
||||
points.add(new Point(primPoint[0], primPoint[1]));
|
||||
}
|
||||
return points;
|
||||
}
|
||||
}
|
||||
|
||||
// Represents a checkers checkerboard
|
||||
class CheckerBoard {
|
||||
// Offsets
|
||||
private List<Point> offsets = Point.asList(new int[][]{{-1, -1}, {1, -1}, {1, 1}, {-1, 1}});
|
||||
private Point[][] matrix;
|
||||
// Team Constants, Team1 is default team.
|
||||
private String team1 = "R";
|
||||
private String team2 = "B";
|
||||
|
||||
CheckerBoard(String[][] matrix) {
|
||||
// Build the point matrix
|
||||
this.matrix = new Point[8][8];
|
||||
for(int x = 0; x < matrix.length; x++) {
|
||||
for(int y = 0; y < matrix[x].length; y++) {
|
||||
this.matrix[x][y] = new Point(x, y, matrix[x][y]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// toString method for a Checkerboard, prints a matrix of types
|
||||
public String toString() {
|
||||
String[] result = new String[this.matrix.length];
|
||||
for(int x = 0; x < this.matrix.length; x++) {
|
||||
String[] temp = new String[this.matrix[x].length];
|
||||
for(int y = 0; y < this.matrix[x].length; y++) {
|
||||
temp[y] = this.matrix[x][y].type.equals("") ? " " : this.matrix[x][y].type; }
|
||||
result[x] = String.join(" - ", temp);
|
||||
}
|
||||
return String.join("\n", result);
|
||||
}
|
||||
|
||||
// Simple functions for identifying whether a point is inBounds.
|
||||
private static boolean inBounds(Point point) {return CheckerBoard.inBounds(point.x, point.y);}
|
||||
private static boolean inBounds(int x, int y) {return x >= 0 && y >= 0 && x < 8 && y < 8;}
|
||||
// Simple internal getter functions
|
||||
private Point getPoint(Point point) {return this.matrix[point.x][point.y];}
|
||||
String getType(Point point) {return this.matrix[point.x][point.y].type;}
|
||||
// Identifies whether two points are opposite in types. R(ed) != B(lack)
|
||||
private boolean isReverse(Point first, Point second) {return (first.type.equals(team1) && second.type.equals(team2)) || (first.type.equals(team2) && second.type.equals(team1));}
|
||||
|
||||
// Just returns all Points with type designated
|
||||
private List<Point> getCheckers(String type) {
|
||||
List<Point> found = new ArrayList<Point>();
|
||||
for (Point[] aMatrix : this.matrix) {
|
||||
for(Point anAMatrix : aMatrix) {
|
||||
if(anAMatrix.type.equals(type))
|
||||
found.add(anAMatrix);
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
// Starter function for finding max jumps at a point.
|
||||
private int getMaxJumps(Point point) {
|
||||
List<Point> previous = new ArrayList<Point>();
|
||||
previous.add(point);
|
||||
return getMaxJumps(point, 0, previous);
|
||||
}
|
||||
|
||||
// Recursively finds maximum possible jumps at a point.
|
||||
private int getMaxJumps(Point point, int score, List<Point> previous) {
|
||||
List<Integer> offsetScores = new ArrayList<Integer>();
|
||||
offsetScores.add(score);
|
||||
for(Point offset : this.offsets) {
|
||||
if(offset.x == 1)
|
||||
continue;
|
||||
Point newPoint = point.merge(offset);
|
||||
// Ensure new point is in matrix bounds
|
||||
if(CheckerBoard.inBounds(newPoint)) {
|
||||
// Ensure new point is of reverse type
|
||||
Point realPoint = this.getPoint(newPoint);
|
||||
if(this.isReverse(point, realPoint)) {
|
||||
newPoint.offset(offset);
|
||||
// Ensure second new point is inBounds & Empty
|
||||
if(CheckerBoard.inBounds(newPoint)) {
|
||||
if(this.getPoint(newPoint).isEmpty()) {
|
||||
if(!newPoint.collectionContains(previous)) {
|
||||
// add new point to blacklist, ensuring we don't get a infinite recursive nightmare
|
||||
previous.add(new Point(newPoint.x, newPoint.y));
|
||||
// will return at least 1
|
||||
offsetScores.add(getMaxJumps(newPoint, score + 1, previous));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Collections.max(offsetScores);
|
||||
}
|
||||
|
||||
// Scanning methods for best jumps
|
||||
public String scan() {return this.scan(this.team1);} // default to Red checkers
|
||||
public String scan(String team) {
|
||||
List<Point> entries = getCheckers(team);
|
||||
List<Integer> jumps = new ArrayList<Integer>();
|
||||
// Scan each entry point for jumps
|
||||
for(Point entry : entries) {
|
||||
jumps.add(getMaxJumps(entry));
|
||||
}
|
||||
|
||||
|
||||
// Find the best origin jump and it's score
|
||||
Point bestpoint = new Point(-1, -1);
|
||||
int bestscore = 0;
|
||||
for(int i = 0; i < entries.size(); i++) {
|
||||
if(bestscore < jumps.get(i)) {
|
||||
bestscore = jumps.get(i);
|
||||
bestpoint = entries.get(i);
|
||||
}
|
||||
}
|
||||
|
||||
return String.format("%s %s %s", bestpoint.x, bestpoint.y, bestscore);
|
||||
}
|
||||
}
|
||||
|
||||
class problem12 {
|
||||
public static void main(String[] args) throws FileNotFoundException {
|
||||
// Constants
|
||||
File input = new File("input.dat");
|
||||
Scanner read = new Scanner(input);
|
||||
int lines = Integer.parseInt(read.nextLine());
|
||||
|
||||
// Start reading and processing the matrix into
|
||||
for(int i = 0; i < lines; i++) {
|
||||
String[][] rawMatrix = new String[8][8];
|
||||
for(int x = 0; x < 8; x++) {
|
||||
String line = read.nextLine();
|
||||
for(int y = 0; y < 8; y++)
|
||||
rawMatrix[x][y] = line.substring(y, y+1);
|
||||
}
|
||||
|
||||
CheckerBoard cb = new CheckerBoard(rawMatrix);
|
||||
out.println(cb);
|
||||
out.println(cb.scan());
|
||||
}
|
||||
|
||||
read.close();
|
||||
}
|
||||
}
|
||||
6
uil/aplus-octoboer-2013/2/java/.idea/misc.xml
generated
Normal file
6
uil/aplus-octoboer-2013/2/java/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
uil/aplus-octoboer-2013/2/java/.idea/modules.xml
generated
Normal file
8
uil/aplus-octoboer-2013/2/java/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/2.iml" filepath="$PROJECT_DIR$/2.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
124
uil/aplus-octoboer-2013/2/java/.idea/uiDesigner.xml
generated
Normal file
124
uil/aplus-octoboer-2013/2/java/.idea/uiDesigner.xml
generated
Normal file
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
238
uil/aplus-octoboer-2013/2/java/.idea/workspace.xml
generated
Normal file
238
uil/aplus-octoboer-2013/2/java/.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,238 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="fda95ca9-6d47-41ab-b6e4-9fbffb16dd5f" name="Default Changelist" comment="" />
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FUSProjectUsageTrigger">
|
||||
<session id="-64511521">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.closed" value="2" />
|
||||
<entry key="project.open.time.0" value="1" />
|
||||
<entry key="project.open.time.3" value="1" />
|
||||
<entry key="project.opened" value="2" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.open">
|
||||
<counts>
|
||||
<entry key="dat" value="3" />
|
||||
<entry key="java" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.open">
|
||||
<counts>
|
||||
<entry key="JAVA" value="1" />
|
||||
<entry key="PLAIN_TEXT" value="3" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="dat" value="364" />
|
||||
<entry key="java" value="850" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="JAVA" value="850" />
|
||||
<entry key="PLAIN_TEXT" value="364" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
</session>
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/problem2.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="153">
|
||||
<caret line="9" column="12" selection-start-line="9" selection-start-column="12" selection-end-line="9" selection-end-column="12" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="GradleLocalSettings">
|
||||
<option name="projectSyncType">
|
||||
<map>
|
||||
<entry key="A:/Programming/Modding/Minecraft/EnderStorage" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/Fabric/fabric-example-mod" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/HelloWorldMod" value="PREVIEW" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/src/input1.dat" />
|
||||
<option value="$PROJECT_DIR$/input1.dat" />
|
||||
<option value="$PROJECT_DIR$/src/problem2.java" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="351" />
|
||||
<option name="y" value="-16" />
|
||||
<option name="width" value="974" />
|
||||
<option name="height" value="1057" />
|
||||
</component>
|
||||
<component name="ProjectView">
|
||||
<navigator proportions="" version="1">
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="2" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="2" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="2" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="2" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1568523728387" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="problem2" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="problem2" />
|
||||
<module name="2" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.problem2" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="fda95ca9-6d47-41ab-b6e4-9fbffb16dd5f" name="Default Changelist" comment="" />
|
||||
<created>1568523104137</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1568523104137</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
|
||||
<layout>
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25266525" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info id="Image Layers" order="2" />
|
||||
<window_info id="Designer" order="3" />
|
||||
<window_info id="UI Designer" order="4" />
|
||||
<window_info id="Capture Tool" order="5" />
|
||||
<window_info id="Favorites" order="6" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.32939914" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="bottom" id="Terminal" order="7" />
|
||||
<window_info anchor="bottom" id="Event Log" order="8" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Version Control" order="9" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Messages" order="10" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
<window_info anchor="right" id="Palette" order="3" />
|
||||
<window_info anchor="right" id="Capture Analysis" order="4" />
|
||||
<window_info anchor="right" id="Theme Preview" order="5" />
|
||||
<window_info anchor="right" id="Palette	" order="6" />
|
||||
<window_info anchor="right" id="Maven Projects" order="7" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/src/input1.dat">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="51">
|
||||
<caret line="3" column="51" selection-start-line="3" selection-start-column="51" selection-end-line="3" selection-end-column="51" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/input1.dat">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="34">
|
||||
<caret line="2" selection-start-line="2" selection-end-line="2" selection-end-column="143" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/problem2.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="153">
|
||||
<caret line="9" column="12" selection-start-line="9" selection-start-column="12" selection-end-line="9" selection-end-column="12" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>11</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
||||
11
uil/aplus-octoboer-2013/2/java/2.iml
Normal file
11
uil/aplus-octoboer-2013/2/java/2.iml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
4
uil/aplus-octoboer-2013/2/java/input1.dat
Normal file
4
uil/aplus-octoboer-2013/2/java/input1.dat
Normal file
@@ -0,0 +1,4 @@
|
||||
3
|
||||
@coolstuff This tweet will have exactly 81 characters so it is definitely a tweet
|
||||
@funnyman This message is really, really, really, long so it will not be a tweet. No one wants a long tweet cuz ain't nobody got time for that!
|
||||
@sweetbrown I am so awesome that Beyonce quotes me!
|
||||
BIN
uil/aplus-octoboer-2013/2/java/out/production/2/problem2.class
Normal file
BIN
uil/aplus-octoboer-2013/2/java/out/production/2/problem2.class
Normal file
Binary file not shown.
18
uil/aplus-octoboer-2013/2/java/src/problem2.java
Normal file
18
uil/aplus-octoboer-2013/2/java/src/problem2.java
Normal file
@@ -0,0 +1,18 @@
|
||||
import static java.lang.System.*;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class problem2 {
|
||||
public static void main(String[] args ) throws FileNotFoundException {
|
||||
// Constants
|
||||
File input = new File("input1.dat");
|
||||
Scanner read = new Scanner(input);
|
||||
int lines = read.nextInt();
|
||||
read.nextLine();
|
||||
// Driver Code
|
||||
for (int i = 0; i < lines; i++)
|
||||
out.println(read.nextLine().length() <= 140 ? "tweet" : "not a tweet");
|
||||
}
|
||||
|
||||
}
|
||||
246
uil/aplus-octoboer-2013/3/input-generator/main.py
Normal file
246
uil/aplus-octoboer-2013/3/input-generator/main.py
Normal file
@@ -0,0 +1,246 @@
|
||||
import os, sys, math, time, random
|
||||
|
||||
class Node(object):
|
||||
def __init__(self, parent=None, position=None):
|
||||
self.parent, self.position = parent, position
|
||||
self.g, self.h, self.f = 0, 0, 0
|
||||
|
||||
def __eq__(self, other):
|
||||
assert type(other) == Node, "Node cannot compared against type \"{}\"".format(str(type(other)))
|
||||
return self.position == other.position
|
||||
|
||||
def __repr__(self):
|
||||
return f'<Node ({self.position[0]}, {self.position[1]})>'
|
||||
|
||||
@classmethod
|
||||
def positionify(self, nodes):
|
||||
return [node.position for node in nodes]
|
||||
|
||||
# Generate a grid and return it to the user
|
||||
class SnakeGrid(object):
|
||||
def __init__(self, x, y, length=3):
|
||||
self.x, self.y, self.length, self.sleepTime = x, y, length, 0.0
|
||||
# Right, Down, Up, Left
|
||||
self.offsets = [[0, 1], [1, 0], [-1, 0], [0, -1]]
|
||||
self.offsetLetters = list("RDUL")
|
||||
self.generate()
|
||||
|
||||
def sleep(self, seconds):
|
||||
self.sleepTime += (seconds, time.sleep(seconds))[0]
|
||||
|
||||
def generate(self):
|
||||
assert self.x > 2 + self.length and self.y > 3, "Dimensions must be able to at least fit the snake"
|
||||
|
||||
# Grid is a matrix of single space strings
|
||||
self.matrix = [[' ' for xx in range(self.x + 1)] for yy in range(self.y + 1)]
|
||||
|
||||
# Choose a initial position
|
||||
self.positions = [self.getPos(-1, -1)]
|
||||
self.mark(self.positions[0])
|
||||
curlength = self.length - 1
|
||||
|
||||
# Start drawing up the snake
|
||||
while curlength > 0:
|
||||
left, right = [self.positions[0][0], self.positions[0][1] - 1], [self.positions[-1][0], self.positions[-1][1] + 1]
|
||||
canLeft, canRight = self.available(left), self.available(right)
|
||||
curlength -= 1
|
||||
|
||||
# If both options are available, just choose one and act like the other is unavailable
|
||||
if canLeft and canRight:
|
||||
if random.choice([True, False]): canLeft = False
|
||||
else: canRight = False
|
||||
|
||||
if canLeft != canRight:
|
||||
if canLeft:
|
||||
self.mark(left)
|
||||
self.positions.insert(0, left)
|
||||
if canRight:
|
||||
self.mark(right)
|
||||
self.positions.append(right)
|
||||
elif not (canLeft or canRight):
|
||||
print(positions, left, right)
|
||||
print("Could not resolve any position to use...?")
|
||||
|
||||
# Populate with 3-7 pellets
|
||||
for _ in range(random.randint(2, 5)):
|
||||
while True:
|
||||
pos = self.getPos()
|
||||
if self.available(pos):
|
||||
self.mark(pos, 'F')
|
||||
break
|
||||
|
||||
# Pythagorean distance calculation
|
||||
def distance(self, pos1, pos2):
|
||||
return math.sqrt(((pos1[0] - pos2[0]) ** 2) + ((pos1[1] - pos2[1]) ** 2))
|
||||
|
||||
# Returns all positions with the specified character (by default, 'F', for pellets)
|
||||
def pellets(self, char='F'):
|
||||
pelletss = []
|
||||
for yy in range(self.y):
|
||||
for xx in range(self.x):
|
||||
if self.available([xx, yy], look=char):
|
||||
pelletss.append([xx, yy])
|
||||
return pelletss
|
||||
|
||||
# Returns the best pellet to path to based on distance and a specified blacklist of positions
|
||||
def bestPellet(self, curpos, blacklist=[]):
|
||||
potential = self.pellets()
|
||||
if blacklist:
|
||||
potential = list(filter(lambda item : item not in blacklist, potential))
|
||||
# Returns None if no potential pellets are in due to blacklist
|
||||
if not potential:
|
||||
return None
|
||||
return min(potential, key=lambda pos : self.distance(curpos, pos))
|
||||
|
||||
# Quick code for calcul
|
||||
def merge(self, pos1, pos2):
|
||||
return [pos1[0] + pos2[0], pos1[1] + pos2[1]]
|
||||
|
||||
def solution(self, maxdist=20, startpos=None):
|
||||
pelletCount, path = self.generateSolutions(maxdist=maxdist, startpos=startpos)
|
||||
for i, pos in enumerate(path):
|
||||
if self.available(pos):
|
||||
self.mark(pos, str(i))
|
||||
return pelletCount, self.mapPositions(path)
|
||||
|
||||
def mapPositions(self, positions):
|
||||
letters = []
|
||||
curpos = positions.pop(0)
|
||||
while len(positions) > 0:
|
||||
nextpos = positions.pop(0)
|
||||
offset = [nextpos[0] - curpos[0], nextpos[1] - curpos[1]]
|
||||
letters.append(offset)
|
||||
curpos = nextpos
|
||||
letters = list(map(lambda item : self.offsetLetters[self.offsets.index(item)], letters))
|
||||
return ''.join(letters)
|
||||
|
||||
# Generater a solution for the maz
|
||||
def generateSolutions(self, maxdist=20, startpos=None):
|
||||
def build_path(current_node):
|
||||
path = []
|
||||
current = current_node
|
||||
while current is not None:
|
||||
path.append(current.position)
|
||||
current = current.parent
|
||||
return (pelletCount, path[::-1])
|
||||
|
||||
# Pathfinding initial constants
|
||||
start_node = Node(None, self.positions[-1])
|
||||
end_node = Node(None, startpos or self.bestPellet(start_node.position))
|
||||
open_list = [start_node]
|
||||
closed_list = [Node(position=pos) for pos in self.pellets(char='X')]
|
||||
finished_end_nodes = []
|
||||
pathdist = 0
|
||||
pelletCount = 1
|
||||
output = ""
|
||||
|
||||
while len(open_list) > 0:
|
||||
# self.sleep(0.125)
|
||||
pathdist += 1
|
||||
# Choose the best node to work on
|
||||
current_index, current_node = min(enumerate(open_list), key=lambda item : item[1].f)
|
||||
open_list.pop(current_index)
|
||||
closed_list.append(current_node)
|
||||
|
||||
|
||||
# Check if we've hit the maximum distance
|
||||
if pathdist >= maxdist:
|
||||
return build_path(current_node)
|
||||
|
||||
# If we've hit the "end node", but still distance to travel, setup a new one
|
||||
if current_node == end_node:
|
||||
finished_end_nodes.append(end_node)
|
||||
start_node = end_node
|
||||
open_list = [start_node]
|
||||
closed_list.append(end_node)
|
||||
end_node = position=self.bestPellet(current_node.position, blacklist=Node.positionify(finished_end_nodes))
|
||||
pelletCount += 1
|
||||
# if we've acquired all pellets by chance
|
||||
if end_node is None:
|
||||
return build_path(current_node)
|
||||
else:
|
||||
end_node = Node(parent=None, position=end_node)
|
||||
|
||||
# Basically iterates upon all positions next to the current node dependent on the cardinal directions
|
||||
for offset in self.offsets:
|
||||
child = self.merge(current_node.position, offset)
|
||||
# Ensure in bounds
|
||||
if self.inBounds(child):
|
||||
child = Node(parent=current_node, position=child)
|
||||
|
||||
if child in closed_list:
|
||||
continue
|
||||
|
||||
# Ensure not already a closed position
|
||||
child.g = current_node.g + 1
|
||||
child.h = self.distance(child.position, end_node.position)
|
||||
child.f = child.g + child.h
|
||||
|
||||
# Ensure that child node is
|
||||
if child not in open_list:
|
||||
open_list.append(child)
|
||||
|
||||
# Quick method for getting a position with the offsets provided
|
||||
def getPos(self, xoffset=0, yoffset=0):
|
||||
return [random.randint(1, self.x + xoffset), random.randint(1, self.y + yoffset)]
|
||||
|
||||
# Quick method for marking a postiion
|
||||
def mark(self, pos, marker='X'):
|
||||
if self.matrix[pos[0]][pos[1]] != ' ':
|
||||
print(f'Overwritten {self.matrix[pos[0][pos[1]]]} with \'{marker}\'')
|
||||
self.matrix[pos[0]][pos[1]] = marker
|
||||
|
||||
# Mechansim for determining whether a position is in the boundaries of the matrix
|
||||
def inBounds(self, pos):
|
||||
return all([pos[0] >= 0, pos[1] >= 0, pos[1] < self.y, pos[0] < self.x])
|
||||
|
||||
# Determine whether a position is available for use
|
||||
def available(self, pos, look=' '):
|
||||
return (self.matrix[pos[0]][pos[1]] == look) if self.inBounds(pos) else False
|
||||
|
||||
def toRawString(self):
|
||||
return '\n'.join(''.join(line) for line in self.matrix)
|
||||
|
||||
def __repr__(self):
|
||||
length = max([max(len(item) for item in sub) for sub in self.matrix])
|
||||
return '\n'.join(' - '.join(map(lambda item : item.ljust(length) if item != ' ' else (' ' * length), line)) for line in self.matrix)
|
||||
|
||||
# Driver Code
|
||||
if __name__ == "__main__":
|
||||
# User Adjustable Constants
|
||||
timing = 0.050
|
||||
iterations = 1
|
||||
size = (15, 15)
|
||||
|
||||
# Build Constants
|
||||
roundTime = lambda seconds : str(round((seconds) * 1000, 2)) + 'ms'
|
||||
centerSize = (2 + len(str(iterations)))
|
||||
dividerTotal = (4 * size[0]) - centerSize
|
||||
dividerCustom = ('-' * (dividerTotal // 2)) + ' {} ' + ('-' * (dividerTotal // 2))
|
||||
dividerTotal = '-' * (dividerTotal + 4)
|
||||
path = os.path.join(sys.path[0], 'output', 'output.dat')
|
||||
file = open(path, 'w+')
|
||||
t1 = time.time()
|
||||
|
||||
# Build and prints matrixes
|
||||
for x in range(iterations):
|
||||
snakegrid = SnakeGrid(size[0], size[1], 3)
|
||||
print(dividerCustom.format(str(x+1).zfill(len(str(iterations)))))
|
||||
file.write(snakegrid.toRawString() + '\n')
|
||||
for position in snakegrid.pellets():
|
||||
pelletCount, solution = snakegrid.solution(startpos=position)
|
||||
if len(solution) >= 5 and pelletCount > 0:
|
||||
file.write(solution + '\n')
|
||||
print(f'{solution} - {pelletCount}')
|
||||
print(dividerTotal)
|
||||
print(snakegrid)
|
||||
# snakegrid.sleep(timing)
|
||||
print(dividerTotal)
|
||||
|
||||
# Finish and print timing statistics
|
||||
file.close()
|
||||
t2 = time.time()
|
||||
print(f'Processing Time : {roundTime(t2 - t1 - snakegrid.sleepTime)}')
|
||||
print(f'Artificial Time : {roundTime(snakegrid.sleepTime)}')
|
||||
print(f'Total Time : {roundTime(t2 - t1)}')
|
||||
print(dividerTotal)
|
||||
20
uil/aplus-octoboer-2013/3/input-generator/output/output.dat
Normal file
20
uil/aplus-octoboer-2013/3/input-generator/output/output.dat
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
F
|
||||
F
|
||||
|
||||
F
|
||||
|
||||
|
||||
|
||||
|
||||
XXX
|
||||
|
||||
|
||||
|
||||
F
|
||||
F
|
||||
|
||||
UUUUULL
|
||||
UULULUL
|
||||
UUUUUURUULL
|
||||
DRDRDD
|
||||
6
uil/aplus-octoboer-2013/3/java/.idea/misc.xml
generated
Normal file
6
uil/aplus-octoboer-2013/3/java/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
uil/aplus-octoboer-2013/3/java/.idea/modules.xml
generated
Normal file
8
uil/aplus-octoboer-2013/3/java/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/3.iml" filepath="$PROJECT_DIR$/3.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
uil/aplus-octoboer-2013/3/java/.idea/vcs.xml
generated
Normal file
6
uil/aplus-octoboer-2013/3/java/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../../../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
291
uil/aplus-octoboer-2013/3/java/.idea/workspace.xml
generated
Normal file
291
uil/aplus-octoboer-2013/3/java/.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,291 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="250f6713-4389-436f-88a0-d6dffc72af7e" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/input.dat" beforeDir="false" afterPath="$PROJECT_DIR$/input.dat" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/problem3.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/problem3.java" afterDir="false" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FUSProjectUsageTrigger">
|
||||
<session id="-261025025">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.open.time.2" value="1" />
|
||||
<entry key="project.opened" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.open">
|
||||
<counts>
|
||||
<entry key="java" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.open">
|
||||
<counts>
|
||||
<entry key="JAVA" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="java" value="44" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="JAVA" value="44" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
</session>
|
||||
<session id="-1963689904">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.closed" value="1" />
|
||||
<entry key="project.open.time.0" value="1" />
|
||||
<entry key="project.opened" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="dat" value="105" />
|
||||
<entry key="java" value="5234" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="JAVA" value="5234" />
|
||||
<entry key="PLAIN_TEXT" value="105" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.open">
|
||||
<counts>
|
||||
<entry key="dat" value="8" />
|
||||
<entry key="java" value="2" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.open">
|
||||
<counts>
|
||||
<entry key="JAVA" value="2" />
|
||||
<entry key="PLAIN_TEXT" value="8" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
</session>
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>out.println</find>
|
||||
<find>out.prin</find>
|
||||
<find>listContains</find>
|
||||
<find>listContai</find>
|
||||
</findStrings>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../../../.." />
|
||||
</component>
|
||||
<component name="GradleLocalSettings">
|
||||
<option name="projectSyncType">
|
||||
<map>
|
||||
<entry key="A:/Programming/Modding/Minecraft/EnderStorage" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/Fabric/fabric-example-mod" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/HelloWorldMod" value="PREVIEW" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/src/problem3.java" />
|
||||
<option value="$PROJECT_DIR$/input.dat" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="351" />
|
||||
<option name="y" value="-16" />
|
||||
<option name="width" value="974" />
|
||||
<option name="height" value="1057" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectView">
|
||||
<navigator proportions="" version="1">
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="java" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="java" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
<pane id="PackagesPane" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1568926048325" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../12" />
|
||||
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="problem3" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="problem3" />
|
||||
<module name="3" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.problem3" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="250f6713-4389-436f-88a0-d6dffc72af7e" name="Default Changelist" comment="" />
|
||||
<created>1568523737759</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1568523737759</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TodoView">
|
||||
<todo-panel id="selected-file">
|
||||
<is-autoscroll-to-source value="true" />
|
||||
</todo-panel>
|
||||
<todo-panel id="all">
|
||||
<are-packages-shown value="true" />
|
||||
<is-autoscroll-to-source value="true" />
|
||||
</todo-panel>
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
|
||||
<layout>
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25266525" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info id="Image Layers" order="2" />
|
||||
<window_info id="Designer" order="3" />
|
||||
<window_info id="UI Designer" order="4" />
|
||||
<window_info id="Capture Tool" order="5" />
|
||||
<window_info id="Favorites" order="6" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Messages" weight="0.32939914" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.29077253" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.39914164" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" weight="0.32939914" />
|
||||
<window_info anchor="bottom" id="Terminal" order="7" weight="0.32939914" />
|
||||
<window_info anchor="bottom" id="Event Log" order="8" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Version Control" order="9" show_stripe_button="false" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
<window_info anchor="right" id="Palette" order="3" />
|
||||
<window_info anchor="right" id="Capture Analysis" order="4" />
|
||||
<window_info anchor="right" id="Theme Preview" order="5" />
|
||||
<window_info anchor="right" id="Palette	" order="6" />
|
||||
<window_info anchor="right" id="Maven Projects" order="7" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="jar://C:/Program Files/AdoptOpenJDK/jdk-8.0.212.04-hotspot/src.zip!/java/lang/Object.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="436">
|
||||
<caret line="234" column="18" selection-start-line="234" selection-start-column="18" selection-end-line="234" selection-end-column="18" />
|
||||
<folding>
|
||||
<element signature="e#11062#11063#0" expanded="true" />
|
||||
<element signature="e#11145#11146#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="jar://C:/Program Files/AdoptOpenJDK/jdk-8.0.212.04-hotspot/src.zip!/java/lang/String.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="232">
|
||||
<caret line="657" selection-start-line="657" selection-end-line="657" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/input.dat">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="238">
|
||||
<caret line="14" column="17" lean-forward="true" selection-start-line="14" selection-start-column="17" selection-end-line="14" selection-end-column="17" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/problem3.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="289">
|
||||
<caret line="88" column="21" lean-forward="true" selection-start-line="88" selection-start-column="21" selection-end-line="88" selection-end-column="21" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#242#243#0" expanded="true" />
|
||||
<element signature="e#261#262#0" expanded="true" />
|
||||
<element signature="e#456#457#0" expanded="true" />
|
||||
<element signature="e#517#518#0" expanded="true" />
|
||||
<element signature="e#597#598#0" expanded="true" />
|
||||
<element signature="e#658#659#0" expanded="true" />
|
||||
<element signature="e#641#648#0" expanded="true" />
|
||||
<element signature="e#692#699#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>11</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
||||
10
uil/aplus-octoboer-2013/3/java/.vscode/launch.json
vendored
Normal file
10
uil/aplus-octoboer-2013/3/java/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "CodeLens (Launch) - problem3",
|
||||
"request": "launch",
|
||||
"mainClass": "problem3"
|
||||
}
|
||||
]
|
||||
}
|
||||
11
uil/aplus-octoboer-2013/3/java/3.iml
Normal file
11
uil/aplus-octoboer-2013/3/java/3.iml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
20
uil/aplus-octoboer-2013/3/java/input.dat
Normal file
20
uil/aplus-octoboer-2013/3/java/input.dat
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
F
|
||||
F
|
||||
|
||||
F
|
||||
|
||||
|
||||
|
||||
|
||||
XXX
|
||||
|
||||
|
||||
|
||||
F
|
||||
F |
|
||||
4
|
||||
UOOOULOOLUOORD
|
||||
UULULULUL
|
||||
UOOOUORUOLOOOODOLDR
|
||||
ODDRDDROD
|
||||
BIN
uil/aplus-octoboer-2013/3/java/out/production/3/Maze.class
Normal file
BIN
uil/aplus-octoboer-2013/3/java/out/production/3/Maze.class
Normal file
Binary file not shown.
BIN
uil/aplus-octoboer-2013/3/java/out/production/3/Point.class
Normal file
BIN
uil/aplus-octoboer-2013/3/java/out/production/3/Point.class
Normal file
Binary file not shown.
BIN
uil/aplus-octoboer-2013/3/java/out/production/3/problem3.class
Normal file
BIN
uil/aplus-octoboer-2013/3/java/out/production/3/problem3.class
Normal file
Binary file not shown.
164
uil/aplus-octoboer-2013/3/java/src/problem3.java
Normal file
164
uil/aplus-octoboer-2013/3/java/src/problem3.java
Normal file
@@ -0,0 +1,164 @@
|
||||
import static java.lang.System.*;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.*;
|
||||
|
||||
// Point representing and (X, Y) coordinate
|
||||
class Point {
|
||||
int x, y;
|
||||
|
||||
Point(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
// Returns a point which is the translated end-point based on the other point (offset).
|
||||
Point merge(Point other) {
|
||||
return new Point(this.x + other.x, this.y + other.y);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return String.format("Point(%d, %d)", this.x, this.y);
|
||||
}
|
||||
|
||||
public boolean equals(Point other) {
|
||||
return this.x == other.x && this.y == other.y;
|
||||
}
|
||||
|
||||
public static boolean collectionContains(Collection<Point> collection, Point point) {
|
||||
for(Point other : collection) {
|
||||
if(point.x == other.x && point.y == other.y) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Class method that searches a List
|
||||
public static int listContains(List<Point> c, Point p) {
|
||||
for(Point o : c) {
|
||||
if(p.x == o.x && p.y == o.y)
|
||||
return c.indexOf(o);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
class Maze {
|
||||
// Offset Constants
|
||||
public List<Point> positionOffsets = Arrays.asList(new Point(1, 0), new Point(0, 1), new Point(-1, 0), new Point(0, -1));
|
||||
private List<String> nameOffsets = Arrays.asList("D R U L".split(" "));
|
||||
// Maze Data
|
||||
List<Point> snake = new ArrayList<Point>();;
|
||||
private List<Point> pellets = new ArrayList<Point>();
|
||||
private char[][] rawMatrix;
|
||||
|
||||
Maze(char[][] rawMatrix) {
|
||||
this.rawMatrix = rawMatrix;
|
||||
|
||||
for(int x = 0; x < 15; x++) {
|
||||
for(int y = 0; y < 15; y++) {
|
||||
switch(rawMatrix[x][y]) {
|
||||
// Empty Space
|
||||
case ' ':
|
||||
break;
|
||||
// Point Found
|
||||
case 'X':
|
||||
this.snake.add(new Point(x, y));
|
||||
break;
|
||||
// Pellet Found
|
||||
case 'F':
|
||||
this.pellets.add(new Point(x, y));
|
||||
break;
|
||||
// Should not be found based on input data. Something has gone wrong/input data is invalid.
|
||||
default:
|
||||
out.println("Possibly faulty Maze Input with item \"" + rawMatrix[x][y] + "\" found.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Simulate the snake game using instructions
|
||||
String simulate(String input) {
|
||||
String curDirection = "R";
|
||||
int score = 0;
|
||||
for(int i = 0; i < input.length(); i++) {
|
||||
// Calculate the offset based on the current instruction
|
||||
Point offset;
|
||||
String curOffset = input.substring(i, i + 1);
|
||||
if(!curDirection.equals(curOffset) && !curOffset.equals("O"))
|
||||
curDirection = curOffset;
|
||||
if(curOffset.equals("O"))
|
||||
offset = positionOffsets.get(nameOffsets.indexOf(curDirection));
|
||||
else
|
||||
offset = positionOffsets.get(nameOffsets.indexOf(curOffset));
|
||||
// Calculate the new point, ensure it's real
|
||||
Point newPoint = snake.get(snake.size() - 1);
|
||||
newPoint = newPoint.merge(offset);
|
||||
// New Point was out of bounds, cannot continue
|
||||
if(!this.inBounds(newPoint))
|
||||
return "GAME OVER";
|
||||
// Add new point, discard end of snake to simulate it's movement
|
||||
snake.remove(0);
|
||||
snake.add(newPoint);
|
||||
// Check if we're at a pellet, add score.
|
||||
int pelletIndex = Point.listContains(pellets, newPoint);
|
||||
if(pelletIndex != -1) {
|
||||
score += 1;
|
||||
this.pellets.remove(pelletIndex);
|
||||
}
|
||||
}
|
||||
return Integer.toString(score);
|
||||
}
|
||||
|
||||
// Methods for testing whether a position is in the maze's boundaries
|
||||
public boolean inBounds(Point point) {return this.inBounds(point.x, point.y);}
|
||||
private boolean inBounds(int x, int y) {return x >= 0 && y >= 0 && x < 15 && y < 15;}
|
||||
|
||||
// Prints a string representation of the Maze
|
||||
public String toString() {
|
||||
String[] lines = new String[15];
|
||||
for(int x = 0; x < 15; x++) {
|
||||
String[] temp = new String[15];
|
||||
for(int y = 0; y < 15; y++) {
|
||||
Point point = new Point(x, y);
|
||||
// Priority: Empty Space < Pellet < Snake
|
||||
temp[y] = Point.collectionContains(this.snake, point) ? "X" : (Point.collectionContains(this.pellets, point) ? "F" : " ");
|
||||
}
|
||||
lines[x] = String.join(" - ", temp);
|
||||
}
|
||||
return String.join("\n", lines);
|
||||
}
|
||||
}
|
||||
|
||||
public class problem3 {
|
||||
public static void main(String[] args ) throws FileNotFoundException {
|
||||
// Constants
|
||||
File fileInput = new File("input.dat");
|
||||
Scanner read = new Scanner(fileInput);
|
||||
|
||||
// Read the maze into a String matrix
|
||||
char[][] rawMatrix = new char[15][15];
|
||||
for(int x = 0; x < 15; x++) {
|
||||
String line = read.nextLine();
|
||||
for(int y = 0; y < 15; y++) {
|
||||
rawMatrix[x][y] = line.charAt(y);
|
||||
}
|
||||
}
|
||||
|
||||
// Read each of the inputs
|
||||
int lines = Integer.parseInt(read.nextLine());
|
||||
String[] inputs = new String[lines];
|
||||
for(int i = 0; i < lines; i++)
|
||||
inputs[i] = read.nextLine();
|
||||
|
||||
// Simulate inputs
|
||||
for(String input : inputs) {
|
||||
Maze maze = new Maze(rawMatrix);
|
||||
String pellets = maze.simulate(input);
|
||||
// Uncomment to display the final position of the maze
|
||||
// out.println(maze);
|
||||
out.println(pellets); }
|
||||
}
|
||||
}
|
||||
6
uil/aplus-octoboer-2013/4/.idea/misc.xml
generated
Normal file
6
uil/aplus-octoboer-2013/4/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
uil/aplus-octoboer-2013/4/.idea/modules.xml
generated
Normal file
8
uil/aplus-octoboer-2013/4/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/4.iml" filepath="$PROJECT_DIR$/4.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
uil/aplus-octoboer-2013/4/.idea/vcs.xml
generated
Normal file
6
uil/aplus-octoboer-2013/4/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
222
uil/aplus-octoboer-2013/4/.idea/workspace.xml
generated
Normal file
222
uil/aplus-octoboer-2013/4/.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,222 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3abb2dc3-d281-4c87-b4d1-b95ea2036242" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FUSProjectUsageTrigger">
|
||||
<session id="52736048">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.closed" value="1" />
|
||||
<entry key="project.open.time.2" value="1" />
|
||||
<entry key="project.opened" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.open">
|
||||
<counts>
|
||||
<entry key="dat" value="1" />
|
||||
<entry key="java" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.open">
|
||||
<counts>
|
||||
<entry key="JAVA" value="1" />
|
||||
<entry key="PLAIN_TEXT" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="dat" value="36" />
|
||||
<entry key="java" value="1038" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="JAVA" value="1038" />
|
||||
<entry key="PLAIN_TEXT" value="36" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
</session>
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../../.." />
|
||||
</component>
|
||||
<component name="GradleLocalSettings">
|
||||
<option name="projectSyncType">
|
||||
<map>
|
||||
<entry key="A:/Programming/Modding/Minecraft/EnderStorage" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/Fabric/fabric-example-mod" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/HelloWorldMod" value="PREVIEW" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/input.dat" />
|
||||
<option value="$PROJECT_DIR$/src/problem4.java" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="-8" />
|
||||
<option name="y" value="-8" />
|
||||
<option name="width" value="1936" />
|
||||
<option name="height" value="1066" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectView">
|
||||
<navigator proportions="" version="1">
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scope" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="4" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="4" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="4" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="4" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="PackagesPane" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1568698793019" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="problem4" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="problem4" />
|
||||
<module name="4" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.problem4" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="3abb2dc3-d281-4c87-b4d1-b95ea2036242" name="Default Changelist" comment="" />
|
||||
<created>1568697525144</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1568697525144</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
|
||||
<layout>
|
||||
<window_info id="Image Layers" />
|
||||
<window_info id="Designer" />
|
||||
<window_info id="UI Designer" />
|
||||
<window_info id="Capture Tool" />
|
||||
<window_info id="Favorites" side_tool="true" />
|
||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.25" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Terminal" />
|
||||
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Messages" weight="0.32939914" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.32939914" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="right" id="Palette" />
|
||||
<window_info anchor="right" id="Theme Preview" />
|
||||
<window_info anchor="right" id="Capture Analysis" />
|
||||
<window_info anchor="right" id="Palette	" />
|
||||
<window_info anchor="right" id="Maven Projects" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/input.dat">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="34">
|
||||
<caret line="2" column="12" lean-forward="true" selection-start-line="2" selection-start-column="12" selection-end-line="2" selection-end-column="12" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/problem4.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="509">
|
||||
<caret line="30" column="30" selection-start-line="30" selection-start-column="30" selection-end-line="30" selection-end-column="30" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>11</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
||||
11
uil/aplus-octoboer-2013/4/4.iml
Normal file
11
uil/aplus-octoboer-2013/4/4.iml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
4
uil/aplus-octoboer-2013/4/input.dat
Normal file
4
uil/aplus-octoboer-2013/4/input.dat
Normal file
@@ -0,0 +1,4 @@
|
||||
3
|
||||
3 4 5 6 8
|
||||
10 12 10 5 6
|
||||
2 3 4 6 9
|
||||
BIN
uil/aplus-octoboer-2013/4/out/production/4/problem4.class
Normal file
BIN
uil/aplus-octoboer-2013/4/out/production/4/problem4.class
Normal file
Binary file not shown.
34
uil/aplus-octoboer-2013/4/src/problem4.java
Normal file
34
uil/aplus-octoboer-2013/4/src/problem4.java
Normal file
@@ -0,0 +1,34 @@
|
||||
import static java.lang.System.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Scanner;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
public class problem4 {
|
||||
public static void main(String[] args) throws FileNotFoundException {
|
||||
File input = new File("input.dat");
|
||||
Scanner read = new Scanner(input);
|
||||
int lines = read.nextInt();
|
||||
|
||||
for(int i = 0; i < lines; i++) {
|
||||
read.nextLine();
|
||||
int[] orig = new int[3];
|
||||
int[] partial = new int[3];
|
||||
orig[0] = read.nextInt();
|
||||
orig[1] = read.nextInt();
|
||||
orig[2] = read.nextInt();
|
||||
partial[0] = read.nextInt();
|
||||
partial[1] = read.nextInt();
|
||||
out.println(process(orig, partial));
|
||||
}
|
||||
}
|
||||
|
||||
static String process(int[] orig, int[] partial) {
|
||||
double multiplier = partial[0] / (double) orig[0];
|
||||
String output = "";
|
||||
partial[2] = (int)(orig[2] * multiplier);
|
||||
for(int sub : partial)
|
||||
output += sub + " ";
|
||||
return output;
|
||||
}
|
||||
}
|
||||
6
uil/aplus-octoboer-2013/5/.idea/misc.xml
generated
Normal file
6
uil/aplus-octoboer-2013/5/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
uil/aplus-octoboer-2013/5/.idea/modules.xml
generated
Normal file
8
uil/aplus-octoboer-2013/5/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/5.iml" filepath="$PROJECT_DIR$/5.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
uil/aplus-octoboer-2013/5/.idea/vcs.xml
generated
Normal file
6
uil/aplus-octoboer-2013/5/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
217
uil/aplus-octoboer-2013/5/.idea/workspace.xml
generated
Normal file
217
uil/aplus-octoboer-2013/5/.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,217 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="87574a0d-bf34-4bba-add5-e92a25021f10" name="Default Changelist" comment="" />
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FUSProjectUsageTrigger">
|
||||
<session id="-143777456">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.closed" value="1" />
|
||||
<entry key="project.open.time.1" value="1" />
|
||||
<entry key="project.opened" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.open">
|
||||
<counts>
|
||||
<entry key="dat" value="1" />
|
||||
<entry key="java" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.open">
|
||||
<counts>
|
||||
<entry key="JAVA" value="1" />
|
||||
<entry key="PLAIN_TEXT" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="dat" value="349" />
|
||||
<entry key="java" value="1384" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="JAVA" value="1384" />
|
||||
<entry key="PLAIN_TEXT" value="349" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
</session>
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../../.." />
|
||||
</component>
|
||||
<component name="GradleLocalSettings">
|
||||
<option name="projectSyncType">
|
||||
<map>
|
||||
<entry key="A:/Programming/Modding/Minecraft/EnderStorage" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/Fabric/fabric-example-mod" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/HelloWorldMod" value="PREVIEW" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/input.dat" />
|
||||
<option value="$PROJECT_DIR$/src/problem5.java" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="-8" />
|
||||
<option name="y" value="-8" />
|
||||
<option name="width" value="1936" />
|
||||
<option name="height" value="1066" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectView">
|
||||
<navigator proportions="" version="1">
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scope" />
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="5" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="5" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1568700267183" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="problem5" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="problem5" />
|
||||
<module name="5" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.problem5" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="87574a0d-bf34-4bba-add5-e92a25021f10" name="Default Changelist" comment="" />
|
||||
<created>1568698803648</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1568698803648</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
|
||||
<layout>
|
||||
<window_info id="Image Layers" />
|
||||
<window_info id="Designer" />
|
||||
<window_info id="UI Designer" />
|
||||
<window_info id="Capture Tool" />
|
||||
<window_info id="Favorites" side_tool="true" />
|
||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.25" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Terminal" />
|
||||
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Messages" weight="0.32939914" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.32939914" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="right" id="Palette" />
|
||||
<window_info anchor="right" id="Theme Preview" />
|
||||
<window_info anchor="right" id="Capture Analysis" />
|
||||
<window_info anchor="right" id="Palette	" />
|
||||
<window_info anchor="right" id="Maven Projects" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/input.dat">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="51">
|
||||
<caret line="3" column="20" selection-start-line="3" selection-start-column="20" selection-end-line="3" selection-end-column="20" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/problem5.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="374">
|
||||
<caret line="22" column="5" lean-forward="true" selection-start-line="22" selection-start-column="5" selection-end-line="22" selection-end-column="5" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#646#647#0" expanded="true" />
|
||||
<element signature="e#704#705#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>11</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
||||
11
uil/aplus-octoboer-2013/5/5.iml
Normal file
11
uil/aplus-octoboer-2013/5/5.iml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
4
uil/aplus-octoboer-2013/5/input.dat
Normal file
4
uil/aplus-octoboer-2013/5/input.dat
Normal file
@@ -0,0 +1,4 @@
|
||||
3
|
||||
1.000 30 1.333 angle
|
||||
1.25 50 n 40
|
||||
2.419 24 1.000 angle
|
||||
BIN
uil/aplus-octoboer-2013/5/out/production/5/problem5.class
Normal file
BIN
uil/aplus-octoboer-2013/5/out/production/5/problem5.class
Normal file
Binary file not shown.
42
uil/aplus-octoboer-2013/5/src/problem5.java
Normal file
42
uil/aplus-octoboer-2013/5/src/problem5.java
Normal file
@@ -0,0 +1,42 @@
|
||||
import static java.lang.System.*;
|
||||
import java.util.Scanner;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
public class problem5 {
|
||||
public static void main(String[] args) throws FileNotFoundException {
|
||||
File input = new File("input.dat");
|
||||
Scanner read = new Scanner(input);
|
||||
int lines = read.nextInt();
|
||||
read.nextLine();
|
||||
|
||||
for(int i = 0; i < lines; i++) {
|
||||
String[] inputArr = new String[4];
|
||||
for(int j = 0; j < 4; j++)
|
||||
inputArr[j] = read.next();
|
||||
out.println(process(inputArr));
|
||||
}
|
||||
}
|
||||
|
||||
static double roundTo(double n, int places) {
|
||||
return Math.round(n * Math.pow(10, places)) / Math.pow(10, places);
|
||||
}
|
||||
|
||||
static String process(String[] input) {
|
||||
double n1 = Double.parseDouble(input[0]);
|
||||
double theta1 = Double.parseDouble(input[1]);
|
||||
double unknown;
|
||||
if(input[2].equals("n")) {
|
||||
unknown = Double.parseDouble(input[3]);
|
||||
double n2 = (n1 * Math.sin(Math.toRadians(theta1))) / Math.sin(Math.toRadians(unknown));
|
||||
return "n = " + roundTo(n2, 4);
|
||||
}
|
||||
else if(input[3].equals("angle")) {
|
||||
unknown = Double.parseDouble(input[2]);
|
||||
return "angle = " + (
|
||||
Math.round(Math.toDegrees(Math.asin((n1 * Math.sin(Math.toRadians(theta1))) / unknown)))
|
||||
);
|
||||
}
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
6
uil/aplus-octoboer-2013/6/.idea/misc.xml
generated
Normal file
6
uil/aplus-octoboer-2013/6/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
uil/aplus-octoboer-2013/6/.idea/modules.xml
generated
Normal file
8
uil/aplus-octoboer-2013/6/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/6.iml" filepath="$PROJECT_DIR$/6.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
uil/aplus-octoboer-2013/6/.idea/vcs.xml
generated
Normal file
6
uil/aplus-octoboer-2013/6/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
284
uil/aplus-octoboer-2013/6/.idea/workspace.xml
generated
Normal file
284
uil/aplus-octoboer-2013/6/.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,284 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="06cce8b2-c032-46de-bc18-ea33f8d1db29" name="Default Changelist" comment="" />
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FUSProjectUsageTrigger">
|
||||
<session id="-340290960">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.closed" value="1" />
|
||||
<entry key="project.open.time.3" value="1" />
|
||||
<entry key="project.opened" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.open">
|
||||
<counts>
|
||||
<entry key="java" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.open">
|
||||
<counts>
|
||||
<entry key="JAVA" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="java" value="743" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="JAVA" value="743" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
</session>
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/problem6.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="306">
|
||||
<caret line="18" column="20" selection-start-line="18" selection-start-column="20" selection-end-line="18" selection-end-column="20" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../../.." />
|
||||
</component>
|
||||
<component name="GradleLocalSettings">
|
||||
<option name="projectSyncType">
|
||||
<map>
|
||||
<entry key="A:/Programming/Modding/Minecraft/EnderStorage" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/Fabric/fabric-example-mod" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/HelloWorldMod" value="PREVIEW" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/src/problem6.java" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="-8" />
|
||||
<option name="y" value="-8" />
|
||||
<option name="width" value="1936" />
|
||||
<option name="height" value="1066" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectView">
|
||||
<navigator proportions="" version="1">
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="6" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="6" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
<pane id="PackagesPane" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1568701013628" />
|
||||
<property name="project.structure.last.edited" value="Modules" />
|
||||
<property name="project.structure.proportion" value="0.0" />
|
||||
<property name="project.structure.side.proportion" value="0.0" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="problem6" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="problem6" />
|
||||
<module name="6" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.problem6" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="06cce8b2-c032-46de-bc18-ea33f8d1db29" name="Default Changelist" comment="" />
|
||||
<created>1568700290265</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1568700290265</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
|
||||
<layout>
|
||||
<window_info id="Image Layers" />
|
||||
<window_info id="Designer" />
|
||||
<window_info id="UI Designer" />
|
||||
<window_info id="Capture Tool" />
|
||||
<window_info id="Favorites" side_tool="true" />
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Terminal" />
|
||||
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Messages" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.32939914" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="right" id="Palette" />
|
||||
<window_info anchor="right" id="Theme Preview" />
|
||||
<window_info anchor="right" id="Capture Analysis" />
|
||||
<window_info anchor="right" id="Palette	" />
|
||||
<window_info anchor="right" id="Maven Projects" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/src/problem6.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="306">
|
||||
<caret line="18" column="20" selection-start-line="18" selection-start-column="20" selection-end-line="18" selection-end-column="20" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ArtifactsStructureConfigurable.UI">
|
||||
<settings>
|
||||
<artifact-editor />
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="FacetStructureConfigurable.UI">
|
||||
<settings>
|
||||
<last-edited>No facets are configured</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="GlobalLibrariesConfigurable.UI">
|
||||
<settings>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="JdkListConfigurable.UI">
|
||||
<settings>
|
||||
<last-edited>1.8</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="ModuleStructureConfigurable.UI">
|
||||
<settings>
|
||||
<last-edited>6</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
<option value="0.6" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>11</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="ProjectLibrariesConfigurable.UI">
|
||||
<settings>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
||||
11
uil/aplus-octoboer-2013/6/6.iml
Normal file
11
uil/aplus-octoboer-2013/6/6.iml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
BIN
uil/aplus-octoboer-2013/6/out/production/6/problem6.class
Normal file
BIN
uil/aplus-octoboer-2013/6/out/production/6/problem6.class
Normal file
Binary file not shown.
41
uil/aplus-octoboer-2013/6/src/problem6.java
Normal file
41
uil/aplus-octoboer-2013/6/src/problem6.java
Normal file
@@ -0,0 +1,41 @@
|
||||
import static java.lang.System.out;
|
||||
|
||||
public class problem6 {
|
||||
public static void main(String[] args) {
|
||||
int[][] data = {
|
||||
{15},
|
||||
{1, 5, 3, 5, 1},
|
||||
{1, 5, 3, 5, 1},
|
||||
{0, 6, 3, 6},
|
||||
{0, 3, 9, 3},
|
||||
{0, 3, 1, 2, 3, 2, 1, 3},
|
||||
{0, 6, 3, 6},
|
||||
{0, 6, 3, 6},
|
||||
{0, 6, 3, 6},
|
||||
{0, 6, 3, 6}};
|
||||
out.println(process(data));
|
||||
}
|
||||
|
||||
static String process(int[][] data) {
|
||||
String output = "";
|
||||
for(int[] sub : data) {
|
||||
boolean doT = true;
|
||||
for(int sequenceN : sub) {
|
||||
output += doT
|
||||
? multiply("T", sequenceN)
|
||||
: multiply(" ", sequenceN);
|
||||
doT = !doT;
|
||||
}
|
||||
output += "\n";
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
static String multiply(String str, int n) {
|
||||
String result = "";
|
||||
for(int i = 0; i < n; i++) {
|
||||
result += str;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
6
uil/aplus-octoboer-2013/7/.idea/misc.xml
generated
Normal file
6
uil/aplus-octoboer-2013/7/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
uil/aplus-octoboer-2013/7/.idea/modules.xml
generated
Normal file
8
uil/aplus-octoboer-2013/7/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/7.iml" filepath="$PROJECT_DIR$/7.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
uil/aplus-octoboer-2013/7/.idea/vcs.xml
generated
Normal file
6
uil/aplus-octoboer-2013/7/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
242
uil/aplus-octoboer-2013/7/.idea/workspace.xml
generated
Normal file
242
uil/aplus-octoboer-2013/7/.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,242 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="bb180874-2412-4c96-b84b-4eb63b971832" name="Default Changelist" comment="" />
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FUSProjectUsageTrigger">
|
||||
<session id="-536804464">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.closed" value="1" />
|
||||
<entry key="project.open.time.1" value="1" />
|
||||
<entry key="project.opened" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.open">
|
||||
<counts>
|
||||
<entry key="dat" value="2" />
|
||||
<entry key="java" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.open">
|
||||
<counts>
|
||||
<entry key="JAVA" value="1" />
|
||||
<entry key="PLAIN_TEXT" value="2" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="dat" value="532" />
|
||||
<entry key="java" value="3129" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="JAVA" value="3129" />
|
||||
<entry key="PLAIN_TEXT" value="532" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
</session>
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/problem7.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="289">
|
||||
<caret line="17" column="16" selection-start-line="17" selection-start-column="16" selection-end-line="17" selection-end-column="16" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/input.dat">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="102">
|
||||
<caret line="6" column="29" selection-start-line="6" selection-start-column="29" selection-end-line="6" selection-end-column="29" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>tortillas</find>
|
||||
</findStrings>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../../.." />
|
||||
</component>
|
||||
<component name="GradleLocalSettings">
|
||||
<option name="projectSyncType">
|
||||
<map>
|
||||
<entry key="A:/Programming/Modding/Minecraft/EnderStorage" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/Fabric/fabric-example-mod" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/HelloWorldMod" value="PREVIEW" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/input.dat" />
|
||||
<option value="$PROJECT_DIR$/src/problem7.java" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="-8" />
|
||||
<option name="y" value="-8" />
|
||||
<option name="width" value="1936" />
|
||||
<option name="height" value="1066" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectView">
|
||||
<navigator proportions="" version="1">
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="7" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="7" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1568703587957" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="problem7" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="problem7" />
|
||||
<module name="7" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.problem7" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="bb180874-2412-4c96-b84b-4eb63b971832" name="Default Changelist" comment="" />
|
||||
<created>1568701177324</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1568701177324</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
|
||||
<layout>
|
||||
<window_info id="Image Layers" />
|
||||
<window_info id="Designer" />
|
||||
<window_info id="UI Designer" />
|
||||
<window_info id="Capture Tool" />
|
||||
<window_info id="Favorites" side_tool="true" />
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Terminal" />
|
||||
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Messages" weight="0.32939914" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.32939914" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.39914164" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="right" id="Palette" />
|
||||
<window_info anchor="right" id="Theme Preview" />
|
||||
<window_info anchor="right" id="Capture Analysis" />
|
||||
<window_info anchor="right" id="Palette	" />
|
||||
<window_info anchor="right" id="Maven Projects" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/input.dat">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="102">
|
||||
<caret line="6" column="29" selection-start-line="6" selection-start-column="29" selection-end-line="6" selection-end-column="29" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/problem7.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="289">
|
||||
<caret line="17" column="16" selection-start-line="17" selection-start-column="16" selection-end-line="17" selection-end-column="16" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>11</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
||||
11
uil/aplus-octoboer-2013/7/7.iml
Normal file
11
uil/aplus-octoboer-2013/7/7.iml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
16
uil/aplus-octoboer-2013/7/input.dat
Normal file
16
uil/aplus-octoboer-2013/7/input.dat
Normal file
@@ -0,0 +1,16 @@
|
||||
3
|
||||
1
|
||||
eggs ham bread
|
||||
ham eggs bread
|
||||
2
|
||||
eggs ham bread lettuce poptarts flour sugar tea hamburger
|
||||
tortillas beans corn tomatoes
|
||||
toy eggs ham bread lettuce poptarts flour sugar tea
|
||||
hamburger candybars corn tomatoes beans tortillas icecream
|
||||
3
|
||||
lettuce carrots tomatoes celery cabbage beans tortillas
|
||||
pork beef chicken ribs bread crackers chips cookies milk
|
||||
oj caprisun drpepper
|
||||
lettuce tomatoes celery cabbage beans tortillas
|
||||
pork beef chicken bread crackers cookies milk
|
||||
caprisun drpepper
|
||||
BIN
uil/aplus-octoboer-2013/7/out/production/7/problem7.class
Normal file
BIN
uil/aplus-octoboer-2013/7/out/production/7/problem7.class
Normal file
Binary file not shown.
54
uil/aplus-octoboer-2013/7/src/problem7.java
Normal file
54
uil/aplus-octoboer-2013/7/src/problem7.java
Normal file
@@ -0,0 +1,54 @@
|
||||
import static java.lang.System.*;
|
||||
import java.util.Arrays;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class problem7 {
|
||||
public static void main(String[] args) throws FileNotFoundException {
|
||||
// Constants
|
||||
File input = new File("input.dat");
|
||||
Scanner read = new Scanner(input);
|
||||
int lines = read.nextInt();
|
||||
read.nextLine();
|
||||
|
||||
// Process all lines
|
||||
for(int i = 0; i < lines; i++) {
|
||||
// Process all lines into primitive String arrays
|
||||
int listLines = read.nextInt();
|
||||
String rawGroceryList = "";
|
||||
String rawReceiptList = "";
|
||||
read.nextLine();
|
||||
// Process all lines into words
|
||||
for(int x = 0; x < listLines; x++)
|
||||
rawGroceryList += read.nextLine() + "\n";
|
||||
for(int x = 0; x < listLines; x++)
|
||||
rawReceiptList += read.nextLine() + "\n";
|
||||
// Split by any whitespace sequence into ArrayLists
|
||||
List<String> groceryList = Arrays.asList(rawGroceryList.split("\\s+"));
|
||||
List<String> receiptList = Arrays.asList(rawReceiptList.split("\\s+"));
|
||||
// Find which to put back
|
||||
String putBack = "PUT BACK";
|
||||
for(String item : receiptList) {
|
||||
if(groceryList.indexOf(item) == -1)
|
||||
putBack += " " + item;
|
||||
}
|
||||
// Find which to buy more of
|
||||
String buyMore = "BUY MORE";
|
||||
for(String item : groceryList) {
|
||||
if(receiptList.indexOf(item) == -1)
|
||||
buyMore += " " + item;
|
||||
}
|
||||
// Process and return final putback/buymore consensus
|
||||
if(putBack.equals("PUT BACK") && buyMore.equals("BUY MORE"))
|
||||
out.println("OK");
|
||||
else if (!putBack.equals("PUT BACK") && buyMore.equals("BUY MORE"))
|
||||
out.println(putBack);
|
||||
else if (putBack.equals("PUT BACK") && !buyMore.equals("BUY MORE"))
|
||||
out.println(buyMore);
|
||||
else
|
||||
out.println(putBack + "\n" + buyMore);
|
||||
}
|
||||
}
|
||||
}
|
||||
6
uil/aplus-octoboer-2013/8/.idea/misc.xml
generated
Normal file
6
uil/aplus-octoboer-2013/8/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
uil/aplus-octoboer-2013/8/.idea/modules.xml
generated
Normal file
8
uil/aplus-octoboer-2013/8/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/8.iml" filepath="$PROJECT_DIR$/8.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
uil/aplus-octoboer-2013/8/.idea/vcs.xml
generated
Normal file
6
uil/aplus-octoboer-2013/8/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
237
uil/aplus-octoboer-2013/8/.idea/workspace.xml
generated
Normal file
237
uil/aplus-octoboer-2013/8/.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,237 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="73175b1a-ab70-457f-b679-e4f92d7ce5de" name="Default Changelist" comment="" />
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FUSProjectUsageTrigger">
|
||||
<session id="-733317992">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.closed" value="1" />
|
||||
<entry key="project.open.time.1" value="1" />
|
||||
<entry key="project.opened" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.open">
|
||||
<counts>
|
||||
<entry key="dat" value="1" />
|
||||
<entry key="java" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.open">
|
||||
<counts>
|
||||
<entry key="JAVA" value="1" />
|
||||
<entry key="PLAIN_TEXT" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="dat" value="7" />
|
||||
<entry key="java" value="622" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="JAVA" value="622" />
|
||||
<entry key="PLAIN_TEXT" value="7" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
</session>
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/problem8.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="238">
|
||||
<caret line="14" column="45" selection-start-line="14" selection-start-column="45" selection-end-line="14" selection-end-column="45" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/input.dat">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="51">
|
||||
<caret line="3" column="1" selection-start-line="3" selection-start-column="1" selection-end-line="3" selection-end-column="1" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../../.." />
|
||||
</component>
|
||||
<component name="GradleLocalSettings">
|
||||
<option name="projectSyncType">
|
||||
<map>
|
||||
<entry key="A:/Programming/Modding/Minecraft/EnderStorage" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/Fabric/fabric-example-mod" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/HelloWorldMod" value="PREVIEW" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/input.dat" />
|
||||
<option value="$PROJECT_DIR$/src/problem8.java" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="-8" />
|
||||
<option name="y" value="-8" />
|
||||
<option name="width" value="1936" />
|
||||
<option name="height" value="1066" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectView">
|
||||
<navigator proportions="" version="1">
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="8" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="8" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="Scope" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1568705451010" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="problem8" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="problem8" />
|
||||
<module name="8" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.problem8" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="73175b1a-ab70-457f-b679-e4f92d7ce5de" name="Default Changelist" comment="" />
|
||||
<created>1568703611139</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1568703611139</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
|
||||
<layout>
|
||||
<window_info id="Image Layers" />
|
||||
<window_info id="Designer" />
|
||||
<window_info id="UI Designer" />
|
||||
<window_info id="Capture Tool" />
|
||||
<window_info id="Favorites" side_tool="true" />
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Terminal" />
|
||||
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Messages" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.38841203" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="right" id="Palette" />
|
||||
<window_info anchor="right" id="Theme Preview" />
|
||||
<window_info anchor="right" id="Capture Analysis" />
|
||||
<window_info anchor="right" id="Palette	" />
|
||||
<window_info anchor="right" id="Maven Projects" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/input.dat">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="51">
|
||||
<caret line="3" column="1" selection-start-line="3" selection-start-column="1" selection-end-line="3" selection-end-column="1" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/problem8.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="238">
|
||||
<caret line="14" column="45" selection-start-line="14" selection-start-column="45" selection-end-line="14" selection-end-column="45" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>11</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
||||
11
uil/aplus-octoboer-2013/8/8.iml
Normal file
11
uil/aplus-octoboer-2013/8/8.iml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
4
uil/aplus-octoboer-2013/8/input.dat
Normal file
4
uil/aplus-octoboer-2013/8/input.dat
Normal file
@@ -0,0 +1,4 @@
|
||||
3
|
||||
2
|
||||
5
|
||||
8
|
||||
BIN
uil/aplus-octoboer-2013/8/out/production/8/problem8.class
Normal file
BIN
uil/aplus-octoboer-2013/8/out/production/8/problem8.class
Normal file
Binary file not shown.
28
uil/aplus-octoboer-2013/8/src/problem8.java
Normal file
28
uil/aplus-octoboer-2013/8/src/problem8.java
Normal file
@@ -0,0 +1,28 @@
|
||||
import static java.lang.System.*;
|
||||
import java.util.Scanner;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
public class problem8 {
|
||||
public static void main(String[] args) throws FileNotFoundException {
|
||||
File input = new File("input.dat");
|
||||
Scanner read = new Scanner(input);
|
||||
read.nextLine();
|
||||
while(read.hasNextInt()) {
|
||||
String result = "";
|
||||
int n = read.nextInt();
|
||||
for(int x = 1; x < n + 1; x++) {
|
||||
result += multiply(" ", n - x) + multiply("C", x) + "\n";
|
||||
}
|
||||
out.println(result);
|
||||
}
|
||||
}
|
||||
|
||||
static String multiply(String str, int n) {
|
||||
String output = "";
|
||||
for(int i = 0; i < n; i++) {
|
||||
output += str;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
}
|
||||
6
uil/aplus-octoboer-2013/9/.idea/misc.xml
generated
Normal file
6
uil/aplus-octoboer-2013/9/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
uil/aplus-octoboer-2013/9/.idea/modules.xml
generated
Normal file
8
uil/aplus-octoboer-2013/9/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/9.iml" filepath="$PROJECT_DIR$/9.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
uil/aplus-octoboer-2013/9/.idea/vcs.xml
generated
Normal file
6
uil/aplus-octoboer-2013/9/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
223
uil/aplus-octoboer-2013/9/.idea/workspace.xml
generated
Normal file
223
uil/aplus-octoboer-2013/9/.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,223 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="814c54e4-1bbe-4be8-8fee-dff98faded8f" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/../12/bin/CheckerBoard.class" beforeDir="false" afterPath="$PROJECT_DIR$/../12/bin/CheckerBoard.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../12/bin/Point.class" beforeDir="false" afterPath="$PROJECT_DIR$/../12/bin/Point.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../12/bin/problem12.class" beforeDir="false" afterPath="$PROJECT_DIR$/../12/bin/problem12.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../12/src/problem12.java" beforeDir="false" afterPath="$PROJECT_DIR$/../12/src/problem12.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FUSProjectUsageTrigger">
|
||||
<session id="-929831496">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.closed" value="2" />
|
||||
<entry key="project.open.time.1" value="1" />
|
||||
<entry key="project.open.time.4" value="1" />
|
||||
<entry key="project.opened" value="2" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.open">
|
||||
<counts>
|
||||
<entry key="dat" value="1" />
|
||||
<entry key="java" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.open">
|
||||
<counts>
|
||||
<entry key="JAVA" value="1" />
|
||||
<entry key="PLAIN_TEXT" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="dat" value="33" />
|
||||
<entry key="java" value="901" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="JAVA" value="901" />
|
||||
<entry key="PLAIN_TEXT" value="33" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
</session>
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../../.." />
|
||||
</component>
|
||||
<component name="GradleLocalSettings">
|
||||
<option name="projectSyncType">
|
||||
<map>
|
||||
<entry key="A:/Programming/Modding/Minecraft/EnderStorage" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/Fabric/fabric-example-mod" value="PREVIEW" />
|
||||
<entry key="A:/Programming/Modding/Minecraft/HelloWorldMod" value="PREVIEW" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/input.dat" />
|
||||
<option value="$PROJECT_DIR$/src/problem9.java" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="-8" />
|
||||
<option name="y" value="-8" />
|
||||
<option name="width" value="1936" />
|
||||
<option name="height" value="1066" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectView">
|
||||
<navigator proportions="" version="1">
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="9" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="9" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
<pane id="PackagesPane" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1568706145579" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../3/java" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="problem9" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="problem9" />
|
||||
<module name="9" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.problem9" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="814c54e4-1bbe-4be8-8fee-dff98faded8f" name="Default Changelist" comment="" />
|
||||
<created>1568705479621</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1568705479621</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
|
||||
<layout>
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25266525" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info id="Image Layers" order="2" />
|
||||
<window_info id="Designer" order="3" />
|
||||
<window_info id="UI Designer" order="4" />
|
||||
<window_info id="Capture Tool" order="5" />
|
||||
<window_info id="Favorites" order="6" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.32939914" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="bottom" id="Terminal" order="7" />
|
||||
<window_info anchor="bottom" id="Event Log" order="8" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Version Control" order="9" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Messages" order="10" weight="0.32939914" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
<window_info anchor="right" id="Palette" order="3" />
|
||||
<window_info anchor="right" id="Capture Analysis" order="4" />
|
||||
<window_info anchor="right" id="Theme Preview" order="5" />
|
||||
<window_info anchor="right" id="Palette	" order="6" />
|
||||
<window_info anchor="right" id="Maven Projects" order="7" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/input.dat">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="68">
|
||||
<caret line="4" column="7" selection-start-line="4" selection-start-column="7" selection-end-line="4" selection-end-column="7" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/problem9.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="323">
|
||||
<caret line="19" column="40" selection-start-line="19" selection-start-column="40" selection-end-line="19" selection-end-column="40" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>11</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
||||
11
uil/aplus-octoboer-2013/9/9.iml
Normal file
11
uil/aplus-octoboer-2013/9/9.iml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
5
uil/aplus-octoboer-2013/9/input.dat
Normal file
5
uil/aplus-octoboer-2013/9/input.dat
Normal file
@@ -0,0 +1,5 @@
|
||||
5 11
|
||||
7 13
|
||||
2 8
|
||||
433 443
|
||||
641 647
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user