Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class euler {
- public static double doorAmt = Math.pow(10,12);
- public static long doorLocation = 0;
- public static long doorsOpened = 0;
- public static boolean stepsDone = false;
- public static void main(String[] args) {
- for (long i = 0; i < doorAmt; i++) {
- if (!stepsDone) {
- doorLocation += (Math.pow(i, 2) + Math.pow(i+1, 2));
- stepsDone = true;
- } if (stepsDone) {
- doorsOpened++;
- stepsDone = false;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement