Last active
December 15, 2020 19:47
-
-
Save Termina1/98b811f4b47392e719612ddd11f58045 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
#define CYCLES 30000000 | |
#include <stdlib.h> | |
#include <stdio.h> | |
static int memory[CYCLES] = {[19] = 1, [0] = 2, [5] = 3, [1] = 4, [10] = 5}; | |
int main () { | |
int i = 7; | |
int prev = 13; | |
int k; | |
while (i <= CYCLES) { | |
k = memory[prev]; | |
memory[prev] = i - 1; | |
prev = 0; | |
if (k != 0) { | |
prev = i - k - 1; | |
} | |
++i; | |
} | |
printf("%i\n", prev); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment