标签:des style blog http io ar color os sp
10 14
70
解题思路:很简单的一个知识点,最小公倍数LCA(a, b) = (a * b)/ GCD(a, b).
AC代码:
#include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> #include <vector> #include <queue> #include <set> #include <map> #include <string> #include <math.h> #include <stdlib.h> #include <time.h> using namespace std; #define INF 0x7fffffff int gcd(int a, int b){ return !b ? a : gcd(b, a%b); } int main() { #ifdef sxk freopen("in.txt","r",stdin); #endif int a, b; while(scanf("%d%d",&a, &b)!=EOF) { printf("%d\n", a*b/gcd(a, b)); } return 0; }
标签:des style blog http io ar color os sp
原文地址:http://blog.csdn.net/u013446688/article/details/41439601