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 |
有可能某一个==成立,导致了最终flag=0In Reply To:Re:这个为什么会错....WA得不行了。。。。 Posted by:lxp_rs at 2006-08-06 18:47:40 > #include "stdio.h" > #include "string.h" > > int a[1010][1010]; > > int main() > { > int n,i,j,flag; > while(1) > { > memset(a,0,sizeof(a)); > scanf("%d",&n); > if(n==0) break; > for(i=0;i<n;i++) > for(j=0;j<n;j++) > scanf("%d",&a[i][j]); > if(n==1) printf("homogeneous\n"); > else > { > for(i=0;i<n;i++) > { > for(j=0;j<n;j++) > { > if((i+1<n)&&(j+1<n)) > { > if(a[i][j]+a[i+1][j+1]==a[i+1][j]+a[i][j+1]) flag=0; > else flag=1; > } > if(flag) break; > } > } > if(flag) printf("not homogeneous\n"); > else printf("homogeneous\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