UVa 10193 All You Need Is Love
Code:
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<iostream>
#include<bitset>
using namespace std;
long int gcd(long int a,long int b)
{
return b ? gcd(b,a%b):a;
}
int main()
{
int cas;
cin>>cas;
for(int i=1; i<=cas; i++)
{
string str1,str2;
cin>>str1>>str2;
bitset<32> n1(str1),n2(str2);
long int k1=n1.to_ulong(),k2=n2.to_ulong();
if(gcd(k1,k2)==1) printf("Pair #%d: Love is not all you need!\n",i);
else printf("Pair #%d: All
you need is love!\n",i);
}
return 0;
}
留言
張貼留言