Skip to content

Instantly share code, notes, and snippets.

@paulhoadley
Last active February 14, 2016 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulhoadley/88597faf08455d5f78b6 to your computer and use it in GitHub Desktop.
Save paulhoadley/88597faf08455d5f78b6 to your computer and use it in GitHub Desktop.
package net.logicsquad.advent;
public class Day20 {
private static final int MIN_SIZE = 34000000;
public static void main(String[] args) {
int house = 1;
while (true) {
int total = 0;
for (int elf = 1; elf <= house; elf++) {
if (house > elf * 50) {
continue;
}
if (house % elf == 0) {
total += elf * 11;
}
}
if (total >= MIN_SIZE) {
break;
}
house++;
}
System.out.println("Day20.main: house = " + house);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment