Initial commit

This commit is contained in:
Dimitri Lozeve 2024-11-12 21:43:32 +01:00
commit f242d2b0df
420 changed files with 62521 additions and 0 deletions

23
2021/day01/day01.c Normal file
View file

@ -0,0 +1,23 @@
#include <stdio.h>
int main(void)
{
int buf[5000] = {0};
int count = 0;
while (scanf("%d\n", &buf[count++]) != EOF);
count--;
int part1 = 0;
for (int i = 1; i < count; ++i) {
part1 += buf[i] > buf[i - 1];
}
printf("%d\n", part1);
int part2 = 0;
for (int i = 3; i < count; ++i) {
part2 += buf[i] > buf[i-3];
}
printf("%d\n", part2);
return 0;
}