26 212 4 Sample Output48
#include<stdio.h>#include<algorithm>#include<iostream>using namespace std;int gcd(int a,int b){ if(a==0) { return b; } else { return gcd(b % a,a); }}int main(){ int n; scanf("%d",&n); while(n--) { int a,b,c,i; scanf("%d%d",&a,&b); for( i=b+b;i<=a*b;i+=b) { if(gcd(a,i)==b) { break; } } printf("%d/n",i); } return 0;}
新闻热点
疑难解答