Poj Solution 1740

http://poj.org/problem?id=1740

/* @author: */
import java.util.Scanner;
public class Main{
 public static void main(String args[]){
 Scanner sc=new Scanner(System.in);
 int a[]=new int[11];
 boolean flag=false;
 while(sc.hasNext())
 {
  flag=true;
  int n=sc.nextInt();
  if(n==0)
    break;
  for(int i=1;i<=n;i++)
   a[i]=sc.nextInt();
   if(n%2==1)
    {
      System.out.printf("1n");
      continue;
    }//������������Ȼ�ǵ�һ����Ӯ
    for(int i=1;i< n&&flag;i++)
     {
      for(int j=i+1;j<=n&&flag;j++)
        if(a[i]!=0&&a[i]==a[j]){
         a[i]=0;
         a[j]=0;
         break;
        }
     
        if(a[i]!=0) flag=false;
     }//�����ż�����ж��Ƿ��˫�ɶ�
    if(!flag)
      System.out.printf("1n");
    else System.out.printf("0n");
 }
}
}
											
This entry was posted in poj. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *