最小公倍数

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 69793    Accepted Submission(s): 38394

Problem Description
给定两个正整数,计算这两个数的最小公倍数。
 
Input
输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.
 
Output
对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。
 
Sample Input
10 14
 
Sample Output
70
 
Source
 

代码:

 #include<stdio.h>
int fun(int a,int b){
if(a%b==)
return b;
else
return fun(b,a%b);
}
int main(){
int a,b,ans;
while(~scanf("%d%d",&a,&b)){
ans=a*b/fun(a,b);
printf("%d\n",ans);
}
return ;
}

HDU 1108.最小公倍数-辗转相除法的更多相关文章

  1. HDU 1108 最小公倍数

    #include <cstdio> int gcd(int a,int b) { ) return a; else return gcd(b,a%b); } int main() { in ...

  2. hdu 2503 1713 1108 最小公倍数&最大公约数

    gcd模板: __int64 gcd(__int64 a,__int64 b) { retur b==0?a:gcd(b,a%b); } 1108: #include<iostream> ...

  3. HDU 1222 - Wolf and Rabbit & HDU 1108 - [最大公约数&最小公倍数]

    水题,只是想借此记一下gcd函数的模板 #include<cstdio> int gcd(int m,int n){return n?gcd(n,m%n):m;} int main() { ...

  4. HDU 1713 最小公倍数与最大公约数的问题 相遇周期

    欢迎参加——BestCoder周年纪念赛(高质量题目+多重奖励) 相遇周期 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/ ...

  5. hdu 1788 最小公倍数(这题面。。。)

    Chinese remainder theorem again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 ...

  6. HDU题解索引

    HDU 1000 A + B Problem  I/O HDU 1001 Sum Problem  数学 HDU 1002 A + B Problem II  高精度加法 HDU 1003 Maxsu ...

  7. Java:函数,类,数组之间的运用

    在我的demoe类中,我实现了以下方法: 这个类在另外一个文件,demoe.java中 public class Demoe { //计算一个数字因子的个数 public static int get ...

  8. CSP2019知识点整理

    也算是接下来二十天的复习计划吧 仅止于联赛难度左右 基础算法 字符串 char[] cstring memset() 输入无& gets(), fgets(stdin, ,); strcmp, ...

  9. HDU 4627(最小公倍数最大问题)

    HDU 4627 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u   Descript ...

随机推荐

  1. c# Stream to File的知识点

    个人倾向使用File.WriteAllByte写入文件: //Stream to File MemoryStream ms=...Stream; ms.Position = ; byte[] buff ...

  2. 【BZOJ1975】【SDOI2010】魔法猪学院 [A*搜索]

    魔法猪学院 Time Limit: 10 Sec  Memory Limit: 64 MB[Submit][Status][Discuss] Description iPig在假期来到了传说中的魔法猪 ...

  3. 【51NOD-0】1134 最长递增子序列

    [算法]动态规划 [题解]经典模型:最长上升子序列(n log n) #include<cstdio> #include<algorithm> #include<cstr ...

  4. 如何升级nodejs版本 安装n模块报错 npm ERR! notsup Unsupported platform

    如何升级nodejs版本 首先安装n模块, 输入npm install -g n n模块专门用来管理nodejs的版本. 如果出现npm ERR! notsup Unsupported platfor ...

  5. z-index 不起作用

    1.第一种情况(z-index无论设置多高都不起作用情况): 这种情况发生的条件有三个: 1.父标签 position属性为relative: 2.问题标签无position属性(不包括static) ...

  6. textarea输入框实时统计输入字符数

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  7. eclipse+EGIT+GitHub

    下载EGIT:http://wiki.eclipse.org/EGit/FAQ#Where_can_I_find_older_releases_of_EGit.3F 1.下载eclipse版本对应的E ...

  8. Python模块学习 - Argparse

    argparse模块 在Python中,argparse模块是标准库中用来解析命令行参数的模块,用来替代已经过时的optparse模块.argparse模块能够根据程序中的定义从sys.argv中解析 ...

  9. 限制printk打印频率函数printk_ratelimit【转】

    转自:http://blog.csdn.net/lkkey80/article/details/45190095 版权声明:博文地址 http://blog.csdn.net/lkkey80?view ...

  10. 【模板】解决二分图匹配的强力算法——Hopcroft-Karp算法

    详细解释 参见:http://blog.csdn.net/wall_f/article/details/8248373 简要过程 HK算法可以当成是匈牙利算法的优化版,和dinic算法的思想比较类似. ...