結果

問題 No.442 和と積
ユーザー atkrymatkrym
提出日時 2016-12-28 10:33:09
言語 Java19
(openjdk 21)
結果
AC  
実行時間 123 ms / 1,000 ms
コード長 425 bytes
コンパイル時間 2,345 ms
コンパイル使用メモリ 72,220 KB
実行使用メモリ 56,140 KB
最終ジャッジ日時 2023-09-18 06:44:16
合計ジャッジ時間 5,887 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
53,820 KB
testcase_01 AC 120 ms
55,268 KB
testcase_02 AC 120 ms
56,140 KB
testcase_03 AC 120 ms
55,676 KB
testcase_04 AC 121 ms
55,744 KB
testcase_05 AC 121 ms
55,672 KB
testcase_06 AC 120 ms
55,720 KB
testcase_07 AC 121 ms
56,068 KB
testcase_08 AC 122 ms
55,600 KB
testcase_09 AC 120 ms
55,676 KB
testcase_10 AC 122 ms
55,460 KB
testcase_11 AC 121 ms
55,848 KB
testcase_12 AC 119 ms
55,972 KB
testcase_13 AC 121 ms
55,920 KB
testcase_14 AC 122 ms
55,560 KB
testcase_15 AC 121 ms
55,840 KB
testcase_16 AC 121 ms
55,696 KB
testcase_17 AC 121 ms
55,700 KB
testcase_18 AC 123 ms
56,032 KB
testcase_19 AC 122 ms
55,560 KB
testcase_20 AC 122 ms
55,508 KB
権限があれば一括ダウンロードができます

ソースコード

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