Commit a52e4800 authored by uxrog's avatar uxrog
Browse files

Merge branch 'gruppe2/exec' into 'master'

Gruppe2/exec

See merge request !43
parents bed76dd9 35219ce7
Pipeline #180543 failed with stage
in 15 minutes and 20 seconds
class Main
{
public static void main(String[] args) {
int[] var = new int[5];
int i = -1;
while ( i < 4) {
System.out.println(new Main().arrayAccess(var, i = i + 1));
}
}
public int arrayAccess(int[] arr, int i) {
return arr[i];
}
}
class FizzBuzz
/*MiniJava Version of FizzBuzz with negative numbers as replacement*/
{
public static void main(String[] args) {
int i = 1;
while (i <= 100) {
if (i % 3 == 0 && i % 5 == 0) {
System.out.println(-3);
} else if (i % 3 == 0) {
System.out.println(-1);
} else if (i % 5 == 0) {
System.out.println(-2);
} else {
System.out.println(i);
}
i = i + 1;
}
}
}
1
2
-1
4
-2
-1
7
8
-1
-2
11
-1
13
14
-3
16
17
-1
19
-2
-1
22
23
-1
-2
26
-1
28
29
-3
31
32
-1
34
-2
-1
37
38
-1
-2
41
-1
43
44
-3
46
47
-1
49
-2
-1
52
53
-1
-2
56
-1
58
59
-3
61
62
-1
64
-2
-1
67
68
-1
-2
71
-1
73
74
-3
76
77
-1
79
-2
-1
82
83
-1
-2
86
-1
88
89
-3
91
92
-1
94
-2
-1
97
98
-1
-2
class FuckTheSystem {
public static void main(String[] args) {
System System = new System();
System.init();
System.out.println(2);
}
}
class System {
public System out;
public void init() { out = new System(); }
public void println(int i) {}
}
/* I swear it's efficient */
class ReallyEfficientFactorization {
public static void main(String[] a_) {
new ReallyEfficientFactorization().factorize(1111251870);
}
public void factorize(int n) {
/* recent studies have shown that n/8 approximates sqrt(n) */
int[] memory_efficiency = new int[n / 8];
int m = n;
int y = 0;
int i = -1;
while (y < m / 2) {
int r = n % (y + 2);
if (r == 0) {
memory_efficiency[(i = i + 1)] = y + 2;
n = n / (y + 2);
} else {
y = y + 1;
}
}
int j = -(i = -(i + 1)) - 1;
while ((i = i + 1) <= 0) {
System.out.println(memory_efficiency[j+i]);
}
}
}
class TestOverflow {
public static void main(String[] args) {
int i = 2147483645;
while(i > 0) {
i = i+1;
System.out.println(i);
}
int j = -2147483647;
j = j-2;
int k = 2147483647+1;
System.out.println(i);
System.out.println(j);
System.out.println(k);
}
}
2147483646
2147483647
-2147483648
-2147483648
2147483647
-2147483648
class A {
public int x;
}
class B {
public boolean x;
public static void main(String[] args) {
int z = 2;
int x = new A().x + z;
}
}
class Axolotl {
public int x;
public static void main(String[] args) {
{
boolean x = false;
}
if (x) {
System.out.println(x);
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment