#include #include #define up 1 #define down 0 char t[200][200]; int mf; int n; int isrectangle (int l, int start, int end, int dir) { char *line; int i,j,m,w; int h = (end-start+1)/2; if (dir == up && (end-start)/2>l) return 0; for (i=0; imf; i-=2) for (j=start; j<=end-i+1; j++) if (isrectangle (l, j, j+i-1, (l^j)&1)) mf = i; } void maxatline (int l) { char *line = t[l], *s, *e; s = line+l; do { s = strchr (s, '-'); if (!s) break; e = strchr (s, '#'); if (!e) e = strchr (s, 0); maxatseq (l, s-line, e-line-1); s = e; } while (*s); } int main() { int i,p=1; FILE *fi = fopen("triangle.in","r"); while (1) { fscanf(fi,"%i\n",&n); if (n==0) break; for (i=0; i