标签:
2 6 2 12 4
4 8
#include <iostream> using namespace std; int GCD(int x,int y) { return y==0?x:GCD(y,x%y); } int main() { int t,a,b; cin>>t; while(t--) { cin>>a>>b; int c = 2*b; while(GCD(a,c)!=b) { c+=b; } cout<<c<<endl; } return 0; }
标签:
原文地址:http://blog.csdn.net/hurmishine/article/details/51473136