Files
aoc/2025/1/part1.c
2025-12-01 10:47:46 +01:00

38 lines
1.3 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* part1.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tomoron <tomoron@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/17 23:03:36 by tomoron #+# #+# */
/* Updated: 2025/12/01 10:45:18 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <stdlib.h>
#include "libft/libft.h"
long int resolve_part1(char *input, char **split)
{
(void)input;
int move_val;
long int cur_val;
long int res;
cur_val = 50;
res = 0;
while(*split)
{
move_val = ft_atoi((*split) + 1);
if(**split == 'L')
move_val *= -1;
cur_val += move_val;
if(cur_val % 100 == 0)
res++;
split++;
}
return(res);
}