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

我都快疯掉了,那位天使告诉我一下我到底什么地方错了(附C代码)

Posted by yanhaofeng at 2006-03-19 13:01:49 on Problem 1970
#include<stdio.h>
int main()
{ int i,j,k,N,t,an,i0,j0,col,x,y,flag,anx,any;
  int a[100][100];
  scanf("%d",&t);
  while(t--)
  { for(i=1;i<=19;i++)
    { for(j=1;j<=19;j++)
      { scanf("%d",&a[i][j]);
      }
    }    
    
    for(i=1;i<=19;i++)
    { for(j=1;j<=19;j++)
      { if(a[i][j]!=0)
        { i0=i;j0=j;an=0;
          col=a[i0][j0];
          for(y=j0;y<=19;y++)
          { if(a[i0][y]==col)an++;
            else break;  
          }//heng                
          if(an==5){anx=i0;any=j0;goto pp;}
          else an=0;
          for(x=i0;x<=19;x++)
          { if(a[x][j0]==col)an++;//shu               
            else break;
          }//printf("s=%d\n",an);
          if(an==5){anx=i0;any=j0;goto pp;}
          else an=0;
          for(x=i0,y=j0;x<=19,y>=1;x++,y--)
          { if(a[x][y]==col)an++;  
            else break;
          }
          //printf("4=%d\n",an);
          if(an==5){anx=x-1;any=y+1;goto pp;}
          else an=0; 
          for(x=i0,y=j0;x<=19,y<=19;x++,y++)
          {if(a[x][y]==col)an++;else break;}
            //printf("4s=%d\n",an);
          if(an==5){anx=i0;any=j0;goto pp;}
          else an=0;
        }
      }
    }
    pp:;
    printf("%d\n",col);
    printf("%d %d\n",anx,any);
               
  } 
   
}
/*
10
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 2 0 0 2 2 2 1 0 0 0 0 0 0 0 0 0 0
0 0 1 2 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
0 0 0 1 2 0 0 0 0 0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 0 0 0 0 0 0 0 0 0 0 0
0 1 2 0 0 2 2 2 1 0 0 0 0 0 0 0 0 0 0
0 0 1 2 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
0 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 2 2 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 2 1 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0


Sample Output


1
3 2


Source
Tehran Sharif 2004 Preliminary

*/

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