結果

問題 No.442 和と積
ユーザー ieneko18ieneko18
提出日時 2016-11-12 19:17:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 1,000 ms
コード長 391 bytes
コンパイル時間 2,128 ms
コンパイル使用メモリ 71,544 KB
実行使用メモリ 56,096 KB
最終ジャッジ日時 2023-09-18 06:27:57
合計ジャッジ時間 5,873 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,592 KB
testcase_01 AC 123 ms
55,864 KB
testcase_02 AC 125 ms
56,096 KB
testcase_03 AC 124 ms
55,616 KB
testcase_04 AC 125 ms
55,576 KB
testcase_05 AC 128 ms
55,732 KB
testcase_06 AC 127 ms
55,568 KB
testcase_07 AC 127 ms
55,748 KB
testcase_08 AC 125 ms
55,872 KB
testcase_09 AC 124 ms
55,904 KB
testcase_10 AC 125 ms
55,540 KB
testcase_11 AC 127 ms
55,864 KB
testcase_12 AC 124 ms
55,780 KB
testcase_13 AC 126 ms
55,524 KB
testcase_14 AC 125 ms
55,640 KB
testcase_15 AC 127 ms
55,980 KB
testcase_16 AC 127 ms
55,640 KB
testcase_17 AC 128 ms
55,636 KB
testcase_18 AC 125 ms
55,708 KB
testcase_19 AC 128 ms
55,604 KB
testcase_20 AC 128 ms
53,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static long gcd(long n,long r){
		return r==0?n:gcd(r,n%r);
	}

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		BigInteger a=sc.nextBigInteger();
		BigInteger b=sc.nextBigInteger();
		BigInteger s=a.add(b);
		BigInteger p=a.multiply(b);
		System.out.println(s.gcd(p));
	}
}
0