标签:esc ane ret 测试 inpu break 条件 logs 接下来
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 19985 Accepted Submission(s): 8352
#include <iostream> #include<math.h> #include <iomanip> #include<cstdio> #include<string> #include<map> #include<vector> #include<list> #include<algorithm> #include<stdlib.h> #include<iterator> #include<sstream> #include<string.h> #include<stdio.h> using namespace std; int gcd(int a,int b) { int big=a; int smal=b; int ck; if(big<smal) { ck=a; a=b; b=a; } int temp; while(smal>0) { temp=big%smal; big=smal; smal=temp; } return big; } int main() { int n; cin>>n; while(n--) { int a,b,c; cin>>a>>b; for(int i=2*b;i<1000000;i=i+b) { if(gcd(a,i)==b)//暴力寻找 { c=i; break; } } cout<<c<<endl; } return 0; }
标签:esc ane ret 测试 inpu break 条件 logs 接下来
原文地址:http://www.cnblogs.com/William-xh/p/7289334.html