From 48966f12832ac97228132e56fb3159099f3e466e Mon Sep 17 00:00:00 2001 From: kartofen Date: Sun, 31 Jul 2022 11:55:45 +0300 Subject: cleanup --- Advent-of-Code-2021/AOC-3/aoc-3 | Bin 16648 -> 0 bytes Advent-of-Code-2021/AOC-3/aoc-3.c | 86 ---------------------------------- Advent-of-Code-2021/AOC-3/aoc-3.c~ | 84 --------------------------------- Advent-of-Code-2021/AOC-3/input.txt~ | 0 Advent-of-Code-2021/AOC-3/main.c | 86 ++++++++++++++++++++++++++++++++++ Advent-of-Code-2021/AOC-3/sample.txt~ | 0 6 files changed, 86 insertions(+), 170 deletions(-) delete mode 100755 Advent-of-Code-2021/AOC-3/aoc-3 delete mode 100644 Advent-of-Code-2021/AOC-3/aoc-3.c delete mode 100644 Advent-of-Code-2021/AOC-3/aoc-3.c~ delete mode 100644 Advent-of-Code-2021/AOC-3/input.txt~ create mode 100644 Advent-of-Code-2021/AOC-3/main.c delete mode 100644 Advent-of-Code-2021/AOC-3/sample.txt~ (limited to 'Advent-of-Code-2021/AOC-3') diff --git a/Advent-of-Code-2021/AOC-3/aoc-3 b/Advent-of-Code-2021/AOC-3/aoc-3 deleted file mode 100755 index d163e8c..0000000 Binary files a/Advent-of-Code-2021/AOC-3/aoc-3 and /dev/null differ diff --git a/Advent-of-Code-2021/AOC-3/aoc-3.c b/Advent-of-Code-2021/AOC-3/aoc-3.c deleted file mode 100644 index 51cab24..0000000 --- a/Advent-of-Code-2021/AOC-3/aoc-3.c +++ /dev/null @@ -1,86 +0,0 @@ -#include -#include -#include -#include -#include - -#define N 5 -#define INP_COUNT 12 - -int table[N]; - -void ParseInput(char *filepath) -{ - char ch; - FILE *fp; - fp = fopen(filepath, "r"); - - if(fp == NULL) - { - fprintf(stderr, "ERROR: something with file idk what fuck you"); - exit(EXIT_FAILURE); - } - - int i = 0; - while((ch = fgetc(fp)) != EOF) - { - if(ch == '\n') { i = 0; continue; } - - if(ch == '1') - table[i] += 1; - - i += 1; - } - - fclose(fp); -} - -void PrintTable() -{ - for(int i=0; i (INP_COUNT/2)) - { - gamma_val = gamma_val | (1 << (N-1-i)); - } - } - - int epsilon_val = gamma_val; - for(int i=0; i -#include -#include -#include -#include - -#define N 5 -#define INP_COUNT 12 - -int table[N]; - -void ParseInput(char *filepath) -{ - char ch; - FILE *fp; - fp = fopen(filepath, "r"); - - if(fp == NULL) - { - fprintf(stderr, "ERROR: something with file idk what fuck you"); - exit(EXIT_FAILURE); - } - - int i = 0; - while((ch = fgetc(fp)) != EOF) - { - if(ch == '\n') { i = 0; continue; } - - if(ch == '1') - table[i] += 1; - - i += 1; - } -} - -void PrintTable() -{ - for(int i=0; i (INP_COUNT/2)) - { - gamma_val = gamma_val | (1 << (N-1-i)); - } - } - - int epsilon_val = gamma_val; - for(int i=0; i +#include +#include +#include +#include + +#define N 5 +#define INP_COUNT 12 + +int table[N]; + +void ParseInput(char *filepath) +{ + char ch; + FILE *fp; + fp = fopen(filepath, "r"); + + if(fp == NULL) + { + fprintf(stderr, "ERROR: something with file idk what fuck you"); + exit(EXIT_FAILURE); + } + + int i = 0; + while((ch = fgetc(fp)) != EOF) + { + if(ch == '\n') { i = 0; continue; } + + if(ch == '1') + table[i] += 1; + + i += 1; + } + + fclose(fp); +} + +void PrintTable() +{ + for(int i=0; i (INP_COUNT/2)) + { + gamma_val = gamma_val | (1 << (N-1-i)); + } + } + + int epsilon_val = gamma_val; + for(int i=0; i