uppgb.c (436B)
1 #include "common.h" 2 3 static inline int iscontain(uint64_t *v) { 4 return ((v[0] <= v[2] && v[3] <= v[1]) || (v[2] <= v[0] && v[1] <= v[3]) || 5 (v[0] <= v[2] && v[2] <= v[1]) || (v[2] <= v[0] && v[0] <= v[3])); 6 } 7 8 int main(int argc, char **argv) { 9 uint64_t v[4]; 10 uint64_t c = 0; 11 FILE *fp = fopen("input", "r"); 12 13 while (readfour(v, fp) != EOF) { 14 if (iscontain(v)) 15 c++; 16 } 17 printf("%llu\n", c); 18 19 return 0; 20 }