Rev 30 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 30 | Rev 36 | ||
---|---|---|---|
1 | package de.viathinksoft.immortal.internal; |
1 | package de.viathinksoft.immortal.internal; |
2 | 2 | ||
3 | import java.math.BigInteger; |
3 | import java.math.BigInteger; |
4 | 4 | ||
5 | public class Endzeitpunkt { |
5 | public class Endzeitpunkt { |
6 | 6 | ||
7 | // Allgemeine Daten zum Test (GenX) |
7 | // Allgemeine Daten zum Test (GenX) |
8 | private static final BigInteger TEST_BEGINN = new BigInteger("1291006160"); |
8 | private static final BigInteger TEST_BEGINN = new BigInteger("1291006160"); |
9 | 9 | ||
10 | // Der alte Algorithmus (r19) |
10 | // Der alte Algorithmus (r19) |
11 | // private static final int ABSCHNITT_STEP = 3; |
11 | // private static final int ABSCHNITT_STEP = 3; |
12 | // private static final BigInteger ABSCHNITT_BEGINN = new BigInteger("789"); |
12 | // private static final BigInteger ABSCHNITT_BEGINN = new BigInteger("789"); |
13 | // private static final BigInteger ABFALL_MEDIAN = new BigInteger("199"); |
13 | // private static final BigInteger ABFALL_MEDIAN = new BigInteger("199"); |
14 | 14 | ||
15 | // Der neue Algorithmus (r20) |
15 | // Der neue Algorithmus (r20) |
- | 16 | // private static final int ABSCHNITT_STEP = 29; |
|
- | 17 | // private static final BigInteger ABSCHNITT_BEGINN = new |
|
- | 18 | // BigInteger("94923"); |
|
- | 19 | // private static final BigInteger ABFALL_MEDIAN = new BigInteger("30"); |
|
- | 20 | ||
- | 21 | // Das erste C-Programm (c 1.0) |
|
- | 22 | // private static final int ABSCHNITT_STEP = 76; |
|
- | 23 | // private static final BigInteger ABSCHNITT_BEGINN = new |
|
- | 24 | // BigInteger("215715"); |
|
- | 25 | // private static final BigInteger ABFALL_MEDIAN = new BigInteger("43"); |
|
- | 26 | ||
- | 27 | // Das erste C-Programm mit Optimierung (c 1.2) |
|
16 | private static final int ABSCHNITT_STEP = 29; |
28 | private static final int ABSCHNITT_STEP = 83; |
17 | private static final BigInteger ABSCHNITT_BEGINN = new BigInteger("94923"); |
29 | private static final BigInteger ABSCHNITT_BEGINN = new BigInteger("230516"); |
18 | private static final BigInteger ABFALL_MEDIAN = new BigInteger("30"); |
30 | private static final BigInteger ABFALL_MEDIAN = new BigInteger("11"); |
19 | 31 | ||
20 | private static BigInteger f(int u) { |
32 | private static BigInteger f(int u) { |
21 | BigInteger res = ABSCHNITT_BEGINN; |
33 | BigInteger res = ABSCHNITT_BEGINN; |
22 | for (int i = ABSCHNITT_STEP + 1; i <= u; i++) { |
34 | for (int i = ABSCHNITT_STEP + 1; i <= u; i++) { |
23 | res = res.add(ABFALL_MEDIAN.multiply(BigInteger.valueOf(i))); |
35 | res = res.add(ABFALL_MEDIAN.multiply(BigInteger.valueOf(i))); |
24 | } |
36 | } |
25 | return res; |
37 | return res; |
26 | } |
38 | } |
27 | 39 | ||
28 | private static BigInteger u(int u) { |
40 | private static BigInteger u(int u) { |
29 | return f(u).add(TEST_BEGINN); |
41 | return f(u).add(TEST_BEGINN); |
30 | } |
42 | } |
31 | 43 | ||
32 | public static void main(String[] args) { |
44 | public static void main(String[] args) { |
33 | int max_step = Integer.MAX_VALUE / 100000; |
45 | int max_step = Integer.MAX_VALUE / 100000; |
34 | 46 | ||
35 | System.out.println("End time for step: " + max_step); |
47 | System.out.println("End time for step: " + max_step); |
36 | System.out.println(u(max_step)); |
48 | System.out.println(u(max_step)); |
37 | } |
49 | } |
38 | 50 | ||
39 | } |
51 | } |
40 | 52 |