AoC2022/04_02.c
2022-12-04 22:07:54 +01:00

15 lines
339 B
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main () {
int sum = 0;
unsigned int p1,p2,r1,r2 = 0;
while (scanf("%u-%u,%u-%u\n", &p1,&p2,&r1,&r2) != EOF) {
if (((p1 <= r1) && (r1 <= p2)) || ((p1 <= r2) && (r2 <= p2)) || (r1 <= p1) && (p1 <= r2) || (r1 <= p2) && (p2 <= r2))
sum +=1;
}
printf("%d\n", sum);
}