Poj 1108
来源:互联网 发布:湖南网络工程学院录取 编辑:程序博客网 时间:2024/06/11 22:23
简单数论题,求最小公倍数。
最小公倍数 = a * b/gcd(a,b);//gcd(a,b):最大公约数
import java.util.Scanner;public class Main { //最大公约数 public static int gcd(int a,int b){ if(b == 0) return a; return gcd(b,a%b); } //最小公倍数 public static int gcb(int a,int b){ return a*b/gcd(a,b); } public static void main(String[] args) { Scanner in = new Scanner(System.in); while(in.hasNext()){ int a = in.nextInt(); int b = in.nextInt(); System.out.println(gcb(a,b)); } }}
0 0
- Poj 1108
- POJ 1108 Split Windows
- POJ
- poj
- POJ
- POJ
- poj
- poj
- POJ
- POJ
- poj
- POJ
- POJ
- POJ
- POJ
- POJ
- POJ
- POJ
- maven(14)------maven构件部署到Nexus
- CSS之标签选择器
- 计算密集型分布式内存存储和运算平台架构
- Spring中配置Junit
- 一起学Google Daydream VR开发,快速入门开发基础教程一:Android端开发环境配置一
- Poj 1108
- Python2.7安装Opencv3
- 正则表达式——POSIX字符类
- 组合数取模常用函数与方法总结
- 理解OpenStack与SDN控制器的集成
- Laravel 框架中文文档
- [Leetcode] 7. Reverse Integer
- 异常:java.lang.NoSuchMethodError: javax.servlet.jsp.JspFactory.getJspApplicationContext
- 【a602】最大乘积