1.

import java.util.Scanner;

/**
* Angewandte Mathematik, SS11
* Problem: 10193 All You need is love
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=13&page=show_problem&problem=1134
*
* @author Benedikt Zšnnchen
* @author Erik Wenzel
* @version 1.0, 03/24/2011
*
* Method : Ad-hoc
* Status : Accepted
* Runtime: 0.116
*/

public class Main
{

/**
* @param args
*/
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int pairs = sc.nextInt();
int result = 1;

for(int i=0; i<pairs; i++)
{
result = ggT(binaryToInt(sc.next()), binaryToInt(sc.next()));
if(result != 1)
{
System.out.println("Pair #"+(i+1)+": All you need is love!");
}
else
{
System.out.println("Pair #"+(i+1)+": Love is not all you need!");
}
}
sc.close();
}

public static int binaryToInt(String binary)
{
int result = 0;
int factor = 1;
for(int i=binary.length()-1; i>=0; i--)
{
result += (binary.charAt(i)-'0')*factor;
factor *= 2;
}
return result;
}

// Euklid Algo
public static int ggT(int a, int b)
{
int r = -1;

while(r!=0)
{
r = a%b;
a = b;
b = r;
}

return a;
}
}



-----------------------------------------------------

1.

/**
* ACM Training 2010
* ACM Problem #10193 - All You Need Is Love
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=13&page=show_problem&problem=1134
*
* @author Felix Dietrich
* @version 1.0, 04/09/2010
*
* Methode: GCD
* Status : Accepted
* Runtime: 1.832
*/

import java.util.*;

public class Main
{
/**
* Greatest common divider of two numbers.
* @param a
* @param b
* @return gcd
*/
static int gcd(int a, int b)
{
if(a == 0)
return b;
while(b != 0)
if (a > b)
a = a - b;
else
b = b - a;
return a;
}

public static void main(String... strs)
{
Scanner sc = new Scanner(System.in);

int testcases = sc.nextInt();

for(int i=0; i<testcases; i++)
{
int s1 = sc.nextInt(2);
int s2 = sc.nextInt(2);

int a = gcd(s1,s2);

System.out.print(String.format("Pair #%d: ", i+1));
System.out.println(a != 1 ? "All you need is love!" : "Love is not all you need!");
}
}
}

2.

**
 *
 * Problem #10193 - All You Need Is Love
 * Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&page=show_problem&problem=1134

 *
 * @author Mariya Vlaseva
 *
 * Status : Accepted
 * Runtime: 1.816
 */

import java.util.*;

public class Main
{   
    public static void main(String... strs)
    {
        Scanner sc = new Scanner(System.in);

        //Anzahl Eingaben
        int count = sc.nextInt();
        //jede 2 Zeilen durchlaufen und vergleichen
        for(int i=0; i<count; i++)
        {
            int line1 = sc.nextInt(2);
            int line2 = sc.nextInt(2);

           
            int a = gcd(line1,line2);
           
            System.out.print(String.format("Pair #%d: ", i+1));
            System.out.println(a != 1 ? "All you need is love!" : "Love is not all you need!");

        }
    }
   
    static int gcd(int a, int b)
    {
        if(a == 0)
           return b;
        while(b != 0)
            if (a > b)
               a = a - b;
            else

               b = b - a;
        return a;
    }
}