水题= =
#include<stdio.h> #include<string.h> #include<math.h> #include<iostream> #include<algorithm> #include<queue> #include<stack> #define mem(a,b) memset(a,b,sizeof(a)) #define ll __int64 #define MAXN 1000 #define INF 0x7ffffff #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 using namespace std; int gcd(int a,int b) { return a%b!=0?gcd(b,a%b):b; } int main() { int a,b; while(scanf("%d%d",&a,&b)!=EOF) { printf("%d\n",a*b/gcd(a,b)); } return 0; }
原文:http://www.cnblogs.com/sola1994/p/3920928.html