Start: Jun, 28, 2019 08:42:00
2019杭州师范大学第一届程序设计竞赛新生赛
End: Jun, 28, 2019 11:42:00
Time elapsed:
Time remaining:

Problem_ID: D
Result: Accepted
Time: 77ms
Memory: 1712kB
In contest: 1276

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
#define ll long long
const int maxn=110;
int gcd(int a,int b)
{
	return b?gcd(b,a%b):a;
}
int main ()
{
	int x,y;
	scanf("%d %d",&x,&y);
	while(y--)
	{
		int a,b;
		scanf("%d %d",&a,&b);
		int t=gcd(a,b);
		if(t>=2)
		{
		    printf("2\n");
		}
		else{
		    printf("1\n");
		}
	}
}