uppgb.c (290B)
1 #include "common.h" 2 3 int main(int argc, char **argv) { 4 char **lines; 5 size_t nlines = readlines(&lines, "input"); 6 7 gd *g = parse(lines, nlines, 1); 8 int r; 9 size_t c = 0; 10 while ((r = sandfall(g)) == 0) 11 c++; 12 13 assert(r == 3); // reached proper end 14 15 printf("%zu\n", c + 1); 16 }