zoukankan      html  css  js  c++  java
  • 最小公倍数

    最小公倍数

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


    Problem Description
    给定两个正整数,计算这两个数的最小公倍数。
     

    Input
    输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.
     

    Output
    对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。
     

    Sample Input
    10 14
     

    Sample Output
    70
    #include<cstdio>
    int yue(int a,int b)
    {
          if(a%b==0)
    	  return b;
    	  else
    	  return  yue(b,a%b);
    }
    int bei(int a,int b)
    {
    	return a/yue(a,b)*b;
    }
    int main()
    {
    	int n,m;
        while(scanf("%d%d",&n,&m)!=EOF)
    	{
    		printf("%d
    ",bei(n,m));
    	
    	}	return 0;
    }

  • 相关阅读:
    然乌湖
    邦达 八宿
    芒康
    巴塘
    禾尼乡 所波大叔
    世界高城 理塘
    相克宗 藏民家
    骑行川藏--新都桥&塔公草原
    d 3
    D2
  • 原文地址:https://www.cnblogs.com/kingjordan/p/12027204.html
Copyright © 2011-2022 走看看