Small Change by hinoe

v[],s[9999],r[9999],i,m,*p;f(j,a){for(;v[j];++j)a>*v?:a-*v?f(*p++=j,a+v[j]),*--p=0:!m|p-s<m&&memcpy(r,s,(m=p-s)*5);}main(){for(;~scanf("%d%c",v+i++,&m);)if(m<11)for(p=s,f(1,i=v[i]=m=0),p=r;printf("-\n"+!!m*3,v[*p++],p[1]?32:10),m**p;);}

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

download

return to the top page