/ neko /

记录详情

Accepted


  
# 状态 耗时 内存占用
#1 Accepted 133ms 9.312 MiB
#2 Accepted 133ms 9.469 MiB
#3 Accepted 135ms 9.312 MiB
#4 Accepted 132ms 9.312 MiB
#5 Accepted 133ms 9.332 MiB
#6 Accepted 133ms 9.363 MiB
#7 Accepted 139ms 9.391 MiB
#8 Accepted 147ms 10.125 MiB
#9 Accepted 153ms 10.227 MiB
#10 Accepted 136ms 9.406 MiB

代码

import java.math.BigInteger;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        BigInteger a=in.nextBigInteger();
        BigInteger b=in.nextBigInteger();
        Main ss=new Main();
        System.out.println(ss.lcm(a,b));

    }
    private BigInteger gcd(BigInteger a, BigInteger b){
        if (a.mod(b).equals(BigInteger.ZERO)){
                return b;
        }else {
           return gcd(b,a.mod(b));
        }
    }
    private BigInteger lcm(BigInteger a,BigInteger b){
        return (a.multiply(b).divide(gcd(a,b)));
    }
}

信息

递交者
类型
递交
题目
P1011 最小公倍数
题目数据
下载
语言
Java
递交时间
2021-02-09 21:00:49
评测时间
2021-02-09 21:00:49
评测机
分数
100
总耗时
1377ms
峰值内存
10.227 MiB