HDOJ_1108_最小公倍数
AC代码:
#include <iostream> #include <cstdio> using namespace std; int gcd(int a,int b) { if(b==0) return a; return gcd(b,a%b); } int main(void) { freopen("in.txt","r",stdin); int a,b; while(scanf("%d%d",&a,&b)!=EOF) { int c; c=gcd(a,b); long temp=a/c*b; printf("%ld\n",temp); } fclose(stdin); return 0; }