Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.

Commit b20e7d6

Browse files
authored
Add files via upload
1 parent e57d9ab commit b20e7d6

15 files changed

+534
-4
lines changed

BugApp.java

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Notes
3+
*
4+
*
5+
*
6+
*/
7+
import java.io.*;
8+
import java.util.*;
9+
public class BugApp {
10+
public static PrintWriter debug;
11+
public static HashMap<Integer,List> db=new HashMap<Integer,List>();
12+
public static ArrayList<int[]> resolver=new ArrayList<int[]>();
13+
public static int info;
14+
public static void setup() {
15+
try {
16+
debug=new PrintWriter(new BufferedWriter(new FileWriter("programdebug.info")));
17+
}catch(Exception e) {
18+
e.printStackTrace();
19+
System.out.println("WARNING:Log file cannot be initliazed, redirecting to stdout! This may be a restrcited system!");
20+
debug=new PrintWriter(System.out);
21+
22+
}
23+
debug.println("Setup completed");
24+
info=0;
25+
db.put(0, new ArrayList<Integer>());
26+
}
27+
public static void session() {
28+
int[] resolved;
29+
debug.println("Session started");
30+
System.out.println("Debug 1.0 Session\nPress enter to stop\nWarning timing this program will be messed up!");
31+
String text=">";
32+
Scanner sc=new Scanner(System.in);
33+
while(!(text.equals(""))) {
34+
System.out.print(">");
35+
text=sc.nextLine();
36+
try {
37+
resolved=resolver.get(Integer.parseInt(text));
38+
show(db.get(resolved[0]).get(resolved[1]));
39+
40+
}catch(Exception e) {
41+
System.out.println("Failed to find "+text);
42+
}
43+
44+
}
45+
}
46+
public static void show(int x) {
47+
System.out.println(x);
48+
}
49+
public static int add(int x) {
50+
db.get("int").add(x);
51+
info++;
52+
return info-1;
53+
}
54+
55+
public static void main(String[] args) {
56+
setup();
57+
String x="test";
58+
Var a=new Var("Testing");
59+
add(a,x);
60+
session();
61+
a.set("sync test");
62+
Var a2=new Var(new ArrayList<Integer>());
63+
add(a2,"arr");
64+
session();
65+
}
66+
67+
}

SimpleSorter.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11

22
public class SimpleSorter {
3-
3+
public static int mode=-1;
4+
public int[] sort1(int[] a) {
5+
return a;
6+
}
7+
public String[] sort2(String[] a) {
8+
return a;
9+
}
10+
public static void sort3(int[] a) {
11+
12+
}
413
public static void main(String[] args) {
514
// TODO Auto-generated method stub
6-
15+
716
}
817

918
}

Test1.java

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import java.util.ArrayList;
2+
3+
public class Test1 {
4+
public static boolean isrect(int[][] map,int x,int y) {
5+
int cachedsize=-1;
6+
int cachey=-1;
7+
for(int i=x;i<map.length;i++) {
8+
if(x>cachedsize) {
9+
return false;
10+
}
11+
for(int j=y;j<map.length;j++) {
12+
if(map[x][y]==0) {
13+
cachey=y;
14+
cachedsize=x;
15+
}
16+
if(y>cachey) {
17+
return false;
18+
}
19+
}
20+
}
21+
return true;
22+
}
23+
public static ArrayList<Integer> touching(int[][] map,int x,int y){
24+
ArrayList<Integer> out=new ArrayList<Integer>();
25+
try {
26+
out.add(map[x-1][y]);
27+
}catch(Exception e) {
28+
29+
}
30+
try {
31+
out.add(map[x+1][y]);
32+
}catch(Exception e) {
33+
34+
}
35+
try {
36+
out.add(map[x][y-1]);
37+
}catch(Exception e) {
38+
39+
}
40+
try {
41+
out.add(map[x][y+1]);
42+
}catch(Exception e) {
43+
44+
}
45+
return out;
46+
47+
}
48+
public static void main(String[] args) {
49+
// TODO Auto-generated method stub
50+
int[][] modernarttest= {
51+
{1,2,3,4,3},
52+
{1,1,3,4,2},
53+
{1,1,3,4,1},
54+
{1,1,1,4,4},
55+
{0,0,0,0,0}
56+
57+
};
58+
System.out.println(isrect(modernarttest,1,1));
59+
System.out.println(isrect(modernarttest,0,0));
60+
System.out.println(isrect(modernarttest,0,3));
61+
62+
}
63+
64+
}

circlecross.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ABCCABDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZ

circlecross.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1

circlecross1.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AABBCCDDEEFFGGHIJKLMNOPQRSTUVWXYZHIJKLMNOPQRSTUVWXYZ

crossroad.java

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import java.util.*;
2+
import java.io.*;
3+
public class crossroad {
4+
5+
public static void main(String[] args) throws IOException {
6+
// TODO Auto-generated method stub
7+
8+
try{
9+
System.out.println("Starting");
10+
BufferedReader f=new BufferedReader(new FileReader("crossroad.in"));
11+
int N=Integer.parseInt(f.readLine());
12+
int cows=10;
13+
int[] Cows=new int[cows];
14+
for(int i=0;i<cows;i++) {Cows[i]=0;}
15+
int[] prev=new int[cows];
16+
int id;
17+
int pos;
18+
for(int i=0;i<cows;i++) {prev[i]=-1;}
19+
StringTokenizer st;
20+
int total=0;
21+
//int previd;
22+
//previd=-1;
23+
24+
for(int i=0;i<N;i++) {
25+
st=new StringTokenizer(f.readLine());
26+
id=Integer.parseInt(st.nextToken())-1;
27+
pos=Integer.parseInt(st.nextToken());
28+
if(prev[id]!=pos) {
29+
if(prev[id]==-1) {
30+
prev[id]=pos;
31+
}else {
32+
Cows[id]++;
33+
prev[id]=pos;
34+
}
35+
}
36+
37+
}
38+
f.close();
39+
for(int i=0;i<cows;i++) {
40+
41+
total=total+Cows[i];
42+
}
43+
try{
44+
System.out.println("TRYING TO WRITE");
45+
PrintWriter pw=new PrintWriter(new BufferedWriter(new FileWriter("crossroad.out")));
46+
pw.println(total);
47+
48+
pw.close();
49+
}catch(IOException e) {
50+
System.out.println("File MISSING");
51+
}
52+
}catch(Exception e) {
53+
System.out.println("ERROR:"+e.getMessage());
54+
System.exit(1);
55+
}
56+
57+
58+
59+
}
60+
61+
}

crossroad.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1

debuggableapp.java

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import java.io.*;
2+
import java.util.*;
3+
class Var {
4+
private Object object;
5+
public Var() {
6+
this.object=null;
7+
}
8+
public Var(Object o) {
9+
this.object=o;
10+
}
11+
public void set(Object object) { this.object = object; }
12+
public Object get() { return object; }
13+
}
14+
public class debuggableapp {
15+
public static PrintWriter debug;
16+
public static HashMap<String,Var> db=new HashMap<String,Var>();
17+
public static void setup() {
18+
try {
19+
debug=new PrintWriter(new BufferedWriter(new FileWriter("programdebug.info")));
20+
}catch(Exception e) {
21+
e.printStackTrace();
22+
System.out.println("WARNING:Log file cannot be initliazed, redirecting to stdout! This may be a restrcited system!");
23+
debug=new PrintWriter(System.out);
24+
25+
}
26+
debug.println("Setup completed");
27+
}
28+
public static void session() {
29+
debug.println("Session started");
30+
System.out.println("Debug 1.0 Session\nPress enter to stop\nWarning timing this program will be messed up!");
31+
String text=">";
32+
Scanner sc=new Scanner(System.in);
33+
while(!(text.equals(""))) {
34+
System.out.print(">");
35+
text=sc.nextLine();
36+
if(db.containsKey(text)) {
37+
show(db.get(text));
38+
}
39+
}
40+
}
41+
public static void show(Var x) {
42+
debug.println(x.getClass());
43+
System.out.println(x.get());
44+
}
45+
public static void add(Var x,String friendlyname) {
46+
db.put(friendlyname, x);
47+
}
48+
public static void set(Var x,String friendlyname) {
49+
db.put(friendlyname, x);
50+
}
51+
public static void main(String[] args) {
52+
setup();
53+
String x="test";
54+
Var a=new Var("Testing");
55+
add(a,x);
56+
session();
57+
a.set("sync test");
58+
Var a2=new Var(new ArrayList<Integer>());
59+
add(a2,"arr");
60+
session();
61+
}
62+
63+
}

lake.class

3.13 KB
Binary file not shown.

0 commit comments

Comments
 (0)