10193 - All You Need Is Love

package uvaTry;

import java.util.Scanner;

class Main10193 {

public static void main(String[] args) {
int a,b;
int n;
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
int count =1;
while(n-->0)
{
a=Integer.parseInt(sc.next(),2);
b=Integer.parseInt(sc.next(),2);
if(gcd(a,b)==1)
System.out.println("Pair #"+count+": Love is not all you need!");
else
System.out.println("Pair #"+count+": All you need is love!");
count++;
}

}
public static int gcd(int a ,int b) {
if(b==0) return a;
return gcd(b,a%b);


}

}

SHARE

Amit Ghosh

    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment