remove inputs

This commit is contained in:
2024-12-02 12:32:14 +01:00
commit 60acac0231
247 changed files with 9071 additions and 0 deletions

81
2022/2/part2.c Normal file
View File

@ -0,0 +1,81 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* res.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tomoron <tomoron@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/17 16:02:52 by tomoron #+# #+# */
/* Updated: 2024/07/17 22:58:17 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include "libft/libft.h"
int get_score(int a, int b)
{
if(b == 1)
{
if(a == 1)
return(3);
if(a == 2)
return(1);
if(a == 3)
return(2);
}
if(b == 2)
return(a + 3);
if(a == 1)
return(2 + 6);
if(a == 2)
return(3 + 6);
return(1 + 6);
}
long int resolve(char *input)
{
char **split;
int i;
long int res;
split = ft_split(input, '\n');
i = 0;
res = 0;
while(split[i])
{
printf("round : %s\n", split[i]);
switch(split[i][0])
{
case 'A':
split[i][0] = 1;
break;
case 'B':
split[i][0] = 2;
break;
case 'C':
split[i][0] = 3;
break;
}
switch(split[i][2])
{
case 'X':
split[i][2] = 1;
break;
case 'Y':
split[i][2] = 2;
break;
case 'Z':
split[i][2] = 3;
break;
}
res += get_score(split[i][0], split[i][2]);
printf("%d vs %d\n", split[i][0], split[i][2]);
printf("round : %d, score : %d\n", i + 1, get_score(split[i][0], split[i][2]));
i++;
}
return(res);
}