Count the Overlap by chocobi

#define m(u,v,w,x)(a[u]=a[x?v:w]<a[x?w:v]?a[v]:a[w])
#define q(u,v,w)((c=(m(u,v,w,1)-m(u-2,v-2,w-2,0)))<0?0:c)
#define p(u,v,w)q(u,v,w)*q(u+1,v+1,w+1)
i,a[99];main(c){for(;~scanf("%*s%d",a+i);i=(i+1)%12)i%4>1&&(a[i]+=a[i-2]),i/11&&((a[26]=p(24,6,10)),printf("ab %d ac %d bc %d abc %d\n",p(14,2,6),p(19,2,10),a[26],p(29,2,24)));}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page