Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:郁闷了,WR好多次了.咋就过不了呢,这? 请高手指点指点啊.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: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator