結果

問題 No.442 和と積
ユーザー atkrym
提出日時 2016-12-28 10:33:09
言語 Java
(openjdk 23)
結果
AC  
実行時間 133 ms / 1,000 ms
コード長 425 bytes
コンパイル時間 3,601 ms
コンパイル使用メモリ 74,284 KB
実行使用メモリ 41,320 KB
最終ジャッジ日時 2024-07-04 22:54:34
合計ジャッジ時間 6,082 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        BigInteger a = new BigInteger(sc.next());
        BigInteger b = new BigInteger(sc.next());
        
        BigInteger s = a.add(b);
        BigInteger p = a.multiply(b);
        
        System.out.println(s.gcd(p).toString());
    }
}
0