#include #include #include #include #include #include #if 1 #undef assert #define assert(x) #endif #define xDEBUG 1 #define xDEBUGG 1 static int F[20000],FN; static int Best[20000]; int Width; static int lineeval(int start,int len) { int letters=0; int i; int mywidth,done; int r=0; int spacestot=0,spaceswant; for (i=0;i=0;start--) { for (items=1;start+items<=FN;items++) { badness=lineeval(start,items); #ifdef DEBUG printf("pass: start=%d,items=%d: badness=%d\n",start,items,badness); #endif if (badness==-1) break; if (start+items < FN) badness+=Best[start+items]-1; if (!Best[start] || badness