結果

問題 No.353 ヘイトプラス
ユーザー aaaaasatoriaaaaasatori
提出日時 2018-02-17 02:06:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 1,000 ms
コード長 478 bytes
コンパイル時間 3,367 ms
コンパイル使用メモリ 72,260 KB
実行使用メモリ 56,052 KB
最終ジャッジ日時 2023-09-17 00:00:42
合計ジャッジ時間 5,003 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,804 KB
testcase_01 AC 119 ms
55,812 KB
testcase_02 AC 121 ms
55,980 KB
testcase_03 AC 122 ms
55,892 KB
testcase_04 AC 122 ms
56,052 KB
testcase_05 AC 125 ms
55,816 KB
testcase_06 AC 125 ms
55,792 KB
testcase_07 AC 126 ms
55,804 KB
testcase_08 AC 125 ms
55,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No353 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		
		if(A-B != 0) {
			System.out.println((A*A - B*B) / (A-B));
		}else if(A == 0 && B != 0) {
			System.out.println(B);
		}else if(A != 0 && B == 0) {
			System.out.println(A);
		}else if(A != 0 && B != 0 && A - B == 0) {
			System.out.println(A*2);
		}else {
			System.out.println(0);
		}
	}
}

0