标签:des style io color ar os sp java for
2 6 2 12 4#include<stdio.h> int gcd(int x,int y) { return y==0?x:gcd(y,x%y); } int main() { int n,i,a,b; scanf("%d",&n); while(n--) { scanf("%d%d",&a,&b); for(i=b+1;;i++) { if(gcd(a,i)==b) break; } printf("%d\n",i); } return 0; }
标签:des style io color ar os sp java for
原文地址:http://blog.csdn.net/hdd871532887/article/details/41214913