Last active
February 14, 2016 11:04
-
-
Save paulhoadley/88597faf08455d5f78b6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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