#include <stdio.h>
struct t { int hasColided; } table[] = {
{ .hasColided = 0 },
{ .hasColided = 1 },
{ .hasColided = 1 },
{ .hasColided = 1 },
{ .hasColided = 1 },
{ .hasColided = 0 },
{ .hasColided = 1 } };
int size = 7;
int getNumPastasColididas(int i, int c) {
return (i < size) ? table[i].hasColided + getNumPastasColididas(i + 1, c) : c;
}
int main(void) {
printf("%d", getNumPastasColididas
(0, 0)); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgpzdHJ1Y3QgdCB7IGludCBoYXNDb2xpZGVkOyB9IHRhYmxlW10gPSB7IAoJeyAuaGFzQ29saWRlZCA9IDAgfSwgCiAgICB7IC5oYXNDb2xpZGVkID0gMSB9LAogICAgeyAuaGFzQ29saWRlZCA9IDEgfSwKICAgIHsgLmhhc0NvbGlkZWQgPSAxIH0sCiAgICB7IC5oYXNDb2xpZGVkID0gMSB9LAogICAgeyAuaGFzQ29saWRlZCA9IDAgfSwKICAgIHsgLmhhc0NvbGlkZWQgPSAxIH0gfTsKaW50IHNpemUgPSA3OwoKaW50IGdldE51bVBhc3Rhc0NvbGlkaWRhcyhpbnQgaSwgaW50IGMpIHsKICAgIHJldHVybiAoaSA8IHNpemUpID8gdGFibGVbaV0uaGFzQ29saWRlZCArIGdldE51bVBhc3Rhc0NvbGlkaWRhcyhpICsgMSwgYykgOiBjOwp9CiAgICAKaW50IG1haW4odm9pZCkgewoJcHJpbnRmKCIlZCIsIGdldE51bVBhc3Rhc0NvbGlkaWRhcygwLCAwKSk7CglyZXR1cm4gMDsKfQo=