Rev 30 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
30 | daniel-mar | 1 | package de.viathinksoft.immortal.internal; |
21 | daniel-mar | 2 | |
3 | import java.math.BigInteger; |
||
4 | |||
5 | public class Endzeitpunkt { |
||
6 | |||
7 | // Allgemeine Daten zum Test (GenX) |
||
8 | private static final BigInteger TEST_BEGINN = new BigInteger("1291006160"); |
||
9 | |||
10 | // Der alte Algorithmus (r19) |
||
11 | // private static final int ABSCHNITT_STEP = 3; |
||
12 | // private static final BigInteger ABSCHNITT_BEGINN = new BigInteger("789"); |
||
13 | // private static final BigInteger ABFALL_MEDIAN = new BigInteger("199"); |
||
14 | |||
15 | // Der neue Algorithmus (r20) |
||
36 | daniel-mar | 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"); |
||
21 | daniel-mar | 20 | |
36 | daniel-mar | 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) |
||
28 | private static final int ABSCHNITT_STEP = 83; |
||
29 | private static final BigInteger ABSCHNITT_BEGINN = new BigInteger("230516"); |
||
30 | private static final BigInteger ABFALL_MEDIAN = new BigInteger("11"); |
||
31 | |||
21 | daniel-mar | 32 | private static BigInteger f(int u) { |
33 | BigInteger res = ABSCHNITT_BEGINN; |
||
34 | for (int i = ABSCHNITT_STEP + 1; i <= u; i++) { |
||
35 | res = res.add(ABFALL_MEDIAN.multiply(BigInteger.valueOf(i))); |
||
36 | } |
||
37 | return res; |
||
38 | } |
||
39 | |||
40 | private static BigInteger u(int u) { |
||
41 | return f(u).add(TEST_BEGINN); |
||
42 | } |
||
43 | |||
44 | public static void main(String[] args) { |
||
45 | int max_step = Integer.MAX_VALUE / 100000; |
||
46 | |||
47 | System.out.println("End time for step: " + max_step); |
||
48 | System.out.println(u(max_step)); |
||
49 | } |
||
50 | |||
51 | } |