hdu 1108 最小公倍数
2011-09-10 19:29
369 查看
http://acm.hdu.edu.cn/showproblem.php?pid=1108
/* 2011-9-10 author:BearFly1990 */ package acm.hdu.tests; import java.io.BufferedInputStream; import java.util.Scanner; public class HDU_1108 { public static void main(String[] args) { Scanner in = new Scanner(new BufferedInputStream(System.in)); int ina , inb; while(in.hasNext()){ ina = in.nextInt(); inb = in.nextInt(); System.out.println(lcm(ina,inb)); } } public static int lcm(int a ,int b){ if(a < b){ int temp = a; a = b; b = temp; } return a * b /gcd(a,b); } public static int gcd(int a , int b){ if(b == 0)return a ; return gcd(b,a%b); } }
相关文章推荐
- HDU 1108 最小公倍数
- acm--最小公倍数(HDU 1108)
- 【hdu 1108】最小公倍数
- hdu 1108 最小公倍数
- hdu 1108 最小公倍数
- hdu 1108 最小公倍数 (GCD)
- hdu-1108 最小公倍数
- hdu 1108 最小公倍数(lcm)
- HDU 最小公倍数 1108 【水】
- hdu 1108 最小公倍数
- HDU 1108 最小公倍数【欧几里得算法】【更相减损术】【stein算法】
- HDU 1108 最小公倍数
- HDU 1108 最小公倍数(水~)
- 【HDU - 1108】 最小公倍数
- HDU 1108 最小公倍数(lcm)
- HDU 1108 最小公倍数
- 【HDU】1108 最小公倍数
- HDU 1108 最小公倍数 欧几里得算法
- hdu 1108 最小公倍数
- hdu-1108-最小公倍数