Last active
March 10, 2016 05:42
-
-
Save desrtfx/bda561ff5c32d3755d49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Day25 { | |
public final static long START = 20151125; | |
public final static int MULTIPLIER = 252533; | |
public final static int DIVISOR = 33554393; | |
public final static int TARGET_ROW = 3010; | |
public final static int TARGET_COL = 3019; | |
public static void main(String[] args) { | |
int iterator = 0; | |
long value = START; | |
for (int i = 1; i <= TARGET_COL; i++) { | |
iterator += i; | |
} | |
for (int i = 0; i < TARGET_ROW - 1; i++) { | |
iterator += TARGET_COL + i; | |
} | |
for (int i = 1; i < iterator; i++) { | |
value = (value * MULTIPLIER) % DIVISOR; | |
} | |
System.out.println("Part 1: Code is: " + value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment