Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## 2n-1, n<=100

Posted by sunmoonstar at 2006-08-16 20:04:31 on Problem 1471
In Reply To:郁闷了,WR好多次了.咋就过不了呢,这? 请高手指点指点啊. Posted by:411465294 at 2006-08-13 12:45:50
```> #include "stdio.h"
> #include "string.h"
> char a[102][102];
> int sanjiao,Ni,Nj;
> void search(int x,int y,int j)
>  { int i,x1=x,x2=x,y1=y,M=1,ture,F[2]={-1,1};
>    ture=0;
>    while(1)
>        { x1++;x2--;y1+=F[j];
> 	if(y1<0||y1>=Ni||x1>=Nj-y1||x2<y1) break;
>          for(i=x2;i<=x1;i++)
>             if(a[y1][i]!='-') ture=1;
>          if(ture==1) break;
> 	else M++;
>         }
>    if(M>sanjiao) sanjiao=M;
>    return ;
>  }
> int main()
>  { int i,j,t=1;
>    char  c;
>    scanf("%d",&Ni);
>    while(Ni)
>       { Nj=2*Ni-1;
>         sanjiao=0;
>         for(i=0;i<Ni;i++)
> 	  {  getchar();
> 	     for(j=0;j<Nj-i;j++)
> 		a[i][j]=getchar();
>             }
>         for(i=0;i<Ni;i++)
>            for(j=i;j<Nj-i;j++)
>                if(a[i][j]=='-') search(j,i,(j-i)%2);
>          printf("Triangle #%d\nThe largest triangle area is %d.\n",t++,sanjiao*sanjiao);
>          scanf("%d",&Ni);
> 	if(Ni!=0) printf("\n");
>       }
>    return 0;
>  }
```

Followed by: