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: 76ms
Memory: 1092kB
In contest: 1276

#include<stdio.h>
int gcd(int x,int y){
	if(y==0) return x;
	gcd(y,x%y);
}
int main(){
	int n,k;
	int a,b;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=k;i++){
		scanf("%d%d",&a,&b);
		if(gcd(a,b)!=1) printf("2\n");
		else printf("1\n");
	}
}