• Source
    1. import java.util.*;
    2. import java.math.*;
    3.  
    4. class Main{
    5. public static void main(String args[]){
    6. Scanner in=new Scanner(System.in);
    7. int tc=0;
    8. String s1,s2;
    9.  
    10. tc=in.nextInt();
    11.  
    12. for(int i=1;i<=tc;i++){
    13. s1=in.next(); // next() exclude space and nextLine() include space take input
    14. s2=in.next();
    15. BigInteger b1=new BigInteger(s1,2);
    16. BigInteger b2=new BigInteger(s2,2);
    17.  
    18. int comp=b1.compareTo(b2);
    19.  
    20. if(comp>0){
    21. if(b1.gcd(b2).intValue() !=1){
    22. prln("Pair #"+i+": All you need is love!" );
    23. }
    24. else
    25. prln("Pair #"+i+": Love is not all you need!" );
    26. }
    27. else if( comp<0 ){
    28. if(b2.gcd(b1).intValue() !=1 ){
    29. prln("Pair #"+i+": All you need is love!" );
    30. }
    31. else
    32. prln("Pair #"+i+": Love is not all you need!" );
    33. }
    34. // int gcd=b1.gcd(b2).intValue();
    35. /*
    36. prln("gcd : "+gcd);
    37. prln("compare : "+comp);
    38. prln("b1 "+b1);
    39. prln("b2 "+b2);
    40. */
    41. }
    42.  
    43. }
    44. public static void prln(Object a){
    45. System.out.println(a);
    46. }
    47. }
    48.  
    49.  
    50.  
    51.  
    52.  
    53.  
    54.