#include <stdio.h>
#define type_t long long
type_t gcb(type_t a, type_t b);
type_t lcm(type_t a, type_t b);
void swap1(type_t *, type_t *);
int main()
{
type_t a, b;
while(scanf("%lld%lld",&a , &b) == 2)
{
printf("%lld\n",lcm(a, b));
}
return 0;
}
type_t gcb(type_t a, type_t b)
{
while(a % b)
{
a = a % b;
swap1(&a, &b);
}
return b;
}
type_t lcm(type_t a, type_t b)
{
return a*b/gcb(a,b);
}
void swap1(type_t * a, type_t * b)
{
int temp = *a;
* a = * b;
*b = temp;
}
注意数可能越界,用long long, 其实用unsiged long 就可以了
分享到:
相关推荐
《Approaching (Almost) Any Machine Learning Problem》
Title: Computer-Based Problem Solving Process Author: Teodor Rus Length: 350 pages Edition: 1 Language: English Publisher: World Scientific Publishing Company Publication Date: 2015-05-30 ISBN-10: ...
The C10K problem
Wicked Environmental Problem
master page search problem viewdata js
Problem Solving with C++, Global Edition by Walter Savitch (author) (Author) Pages:1117 出版社: Pearson Education Limited; 10th edition edition (November 20, 2017) Language: English ISBN-10: ...
MCM 2012年 problem A problem B problem C 枪手论文
On a problem of formal logic___ramsey___1928On a problem of formal logic___ramsey___1928On a problem of formal logic___ramsey___1928On a problem of formal logic___ramsey___1928On a problem of formal ...
8D is a problem-solving methodology for product and process improvement. It is structured into eight disciplines, emphasizing team synergy. The team as whole is better and smarter than the quality sum...
Problem solving with C++
node-problem-detector 镜像包 v0.8.7 版本
Problem Arrangement zoj 3777
Java An Introduction to Problem Solving and Programming全英文,第六版,共享给大家,希望有需要的朋友喜欢
算法设计里关于taxi problem的C语言代码
this is the machine problem solution for operating system class
Inverse Problem Theory and Methods for Model Parameter Estimation - A. Tarantola(牛叉)
The problem is to find an algorithm to ensure that the loyal generals will reach agreement. It is shown that, using only oral messages, this problem is solvable if and only if more than two-thirds of...
Problem Solving in Data Structures & Algorithms Using C# 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
java xml realworld problem,java xml 技术 详细说明明
Algorithmic Problem Solving By 作者: Roland Backhouse ISBN-10 书号: 0470684534 ISBN-13 书号: 9780470684535 Edition 版本: 1 出版日期: 2011-10-24 pages 页数: 432 An entertaining and captivating way to ...