diff options
author | kartofen <mladenovnasko0@gmail.com> | 2022-07-31 11:55:45 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2022-07-31 11:55:45 +0300 |
commit | 48966f12832ac97228132e56fb3159099f3e466e (patch) | |
tree | 9cc37aab6d00230787e19b68127abd2b818068ef /Advent-of-Code-2021/AOC-6 | |
parent | aec1c07260257ba7c28eff53f422ddb7daaf316a (diff) |
cleanup
Diffstat (limited to 'Advent-of-Code-2021/AOC-6')
-rwxr-xr-x | Advent-of-Code-2021/AOC-6/aoc-6 | bin | 16480 -> 0 bytes | |||
-rw-r--r-- | Advent-of-Code-2021/AOC-6/aoc-6.c~ | 65 | ||||
-rw-r--r-- | Advent-of-Code-2021/AOC-6/main.c (renamed from Advent-of-Code-2021/AOC-6/aoc-6.c) | 0 |
3 files changed, 0 insertions, 65 deletions
diff --git a/Advent-of-Code-2021/AOC-6/aoc-6 b/Advent-of-Code-2021/AOC-6/aoc-6 Binary files differdeleted file mode 100755 index 9fe1541..0000000 --- a/Advent-of-Code-2021/AOC-6/aoc-6 +++ /dev/null diff --git a/Advent-of-Code-2021/AOC-6/aoc-6.c~ b/Advent-of-Code-2021/AOC-6/aoc-6.c~ deleted file mode 100644 index 5b51725..0000000 --- a/Advent-of-Code-2021/AOC-6/aoc-6.c~ +++ /dev/null @@ -1,65 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#define N 9 -#define MAXDAYS 80 - -int table[N]; - -void PrintTable() -{ - for(int i=0; i<N; i++) - { - printf("%d: %d\n", i, table[i]); - } -} - -void NextDay() -{ - int temp_table[N]; - memset(temp_table, 0, sizeof(int)*N); - - for(int i=1; i<N; i++) - { - temp_table[i-1] = table[i]; - } - - temp_table[6] += table[0]; - temp_table[8] += table[0]; - - memcpy(table, temp_table, sizeof(int)*N); -} - -int TableSize() -{ - int size = 0; - for(int i=0; i<N; i++) - { - size += table[i]; - } - - return size; -} - -int main(void) -{ - memset(table, 0, sizeof(int)*N); - - table[1] = 1; - table[2] = 1; - table[3] = 2; - table[4] = 1; - - for(int i=0; i < MAXDAYS; i++) - { - NextDay(); - } - - PrintTable(); - printf("Size: %d\n", TableSize()); - printf("Day: %d\n", MAXDAYS); - - return 0; -} diff --git a/Advent-of-Code-2021/AOC-6/aoc-6.c b/Advent-of-Code-2021/AOC-6/main.c index 42cd75b..42cd75b 100644 --- a/Advent-of-Code-2021/AOC-6/aoc-6.c +++ b/Advent-of-Code-2021/AOC-6/main.c |