11 bool grid
[ROWS
][COLS
];
16 grow (const char *str
, int n
)
23 if (sscanf (p
, "%dx%d)%n", &x
, &y
, &l
) != 2)
26 count
+= y
* grow (p
, x
);
35 int main(int argc
, char **argv
)
39 while (!isspace (c
= getchar ())) {
42 if (scanf ("%dx%d)", &x
, &y
) != 2)
45 fread (s
, 1, x
, stdin
);
46 count
+= y
* grow (s
, x
);
51 printf ("decompressed length: %lld\n", count
);