Skip to content

Instantly share code, notes, and snippets.

@Termina1
Last active December 15, 2020 19:47
Show Gist options
  • Save Termina1/98b811f4b47392e719612ddd11f58045 to your computer and use it in GitHub Desktop.
Save Termina1/98b811f4b47392e719612ddd11f58045 to your computer and use it in GitHub Desktop.
#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