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

为什么Wrong Answer?

Posted by AC22 at 2008-07-21 17:40:08 on Problem 2160
#include"stdio.h"
int main()
{ int i=0,j,flag=1,k1,k2,k3,a,b,w[6],h[6],aw[4],ah[4];
  while(i<6)
  { scanf("%d %d",&w[i],&h[i]); i++;
  }
  for(j=1;j<6;j++)
  { if((w[0]==w[j]&&h[0]==h[j])||(w[0]==h[j]&&w[j]==h[0]))
    { aw[1]=w[0]; ah[1]=h[0]; k1=j; break;
    }
  } 
  if(j==6) flag=0;
  else if(k1==1)
  { for(j=3;j<6;j++)
    { if((w[2]==w[j]&&h[2]==h[j])||(w[2]==h[j]&&w[j]==h[2]))
      { aw[2]=w[2]; ah[2]=h[2]; k2=j; break;
      }
    } if(j==6) flag=0; a=2;
  }
  else
  { for(j=2;j<6;j++)
    { if(((w[1]==w[j]&&h[1]==h[j])||(w[1]==h[j]&&w[j]==h[1]))&&j!=k1)
      { aw[2]=w[1]; ah[2]=h[1]; k2=j; break;
      }
    } if(j==6) flag=0; a=1;
  }
  if(j!=6)
  { for(i=2;i<=5;i++)
    { if((i!=a)&&(i!=k1)&&(i!=k2)) {b=i; break;}
    }
    for(i=b+1;i<=5;i++)
	{ if((i!=a)&&(i!=k1)&&(i!=k2)) {k3=i;break;}
	}
    if((w[b]==w[k3]&&h[b]==h[k3])||(w[b]==h[k3]&&w[k3]==h[b]))
	{ aw[3]=w[b]; ah[3]=h[b];
	}
	else flag=0;
  }
  if(flag!=0)
  { if((aw[1]==aw[3]&&((ah[1]==ah[2]&&aw[2]==ah[3])||(ah[1]==aw[2]&&ah[2]  ==ah[3])))||(aw[1]==ah[3]&&((ah[1]==ah[2]&&aw[2]==aw[3])||(ah[1]==aw[2]&&ah[2]==aw[3]))))
    printf("POSSIBLE\n");
    else flag=0;
  }
  if(flag==0) printf("IMPOSSIBLE\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