Poj Solution 3219

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

//* @author: 
import java.util.*;
 public class Main{
   public static void main(String args[]){
     Scanner sc=new Scanner(System.in);
     int n=0;
     int k=0;
     int m=0;
     
     while(sc.hasNext()){  
       int a=0;
       int b=0;
       int c=0;
       n=sc.nextInt();
       k=sc.nextInt();       
       m=n-k;
   
       while((n=n>>1)!=0) //��n�ĸ������λ����һλ�����൱�ڳ���2
             a+=n;
       
       while((m=m>>1)!=0)
             b+=m;
     
       while((k=k>>1)!=0)
             c+=k;
       
       if(a-b>c)  //�жϷ��ӷ�ĸ��2�ĸ���Ķ���
            System.out.printf("0n");
       else
            System.out.printf("1n");
     }
   }
}
											
This entry was posted in poj. Bookmark the permalink.

Leave a Reply

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