Skip to content

Instantly share code, notes, and snippets.

@jhtan
Created February 11, 2014 18:13
Show Gist options
  • Save jhtan/8940656 to your computer and use it in GitHub Desktop.
Save jhtan/8940656 to your computer and use it in GitHub Desktop.
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
if(b == 0)
return a;
else
gcd(b, a%b);
}
int main()
{
int t;
long long a, b;
scanf("%d", &t);
while(t--) {
scanf("%lld %lld", &a, &b);
int g = gcd(a, b);
while(g % 2 == 0)
g /= 2;
if(g == 1)
printf("Y\n");
else
printf("N\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment