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

有可能某一个==成立,导致了最终flag=0

Posted by forgotten at 2006-08-06 18:54:11 on Problem 2941
In 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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator