結果

問題 No.1009 面積の求め方
ユーザー htensaihtensai
提出日時 2020-03-25 09:47:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 428 bytes
コンパイル時間 2,289 ms
コンパイル使用メモリ 71,808 KB
実行使用メモリ 56,148 KB
最終ジャッジ日時 2023-08-30 09:27:39
合計ジャッジ時間 6,188 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
56,096 KB
testcase_01 AC 123 ms
55,576 KB
testcase_02 AC 122 ms
56,128 KB
testcase_03 AC 123 ms
56,144 KB
testcase_04 AC 123 ms
55,792 KB
testcase_05 AC 123 ms
55,804 KB
testcase_06 AC 124 ms
56,080 KB
testcase_07 AC 123 ms
56,064 KB
testcase_08 AC 124 ms
55,724 KB
testcase_09 AC 121 ms
55,696 KB
testcase_10 AC 123 ms
55,576 KB
testcase_11 AC 123 ms
55,820 KB
testcase_12 AC 126 ms
56,140 KB
testcase_13 AC 126 ms
55,936 KB
testcase_14 AC 124 ms
56,064 KB
testcase_15 AC 124 ms
55,572 KB
testcase_16 AC 125 ms
56,148 KB
testcase_17 AC 118 ms
55,672 KB
testcase_18 AC 124 ms
55,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double a = sc.nextInt();
        double b = sc.nextInt();
        double aResult = Math.pow(a, 3) / 3 - (a + b) * Math.pow(a, 2) / 2 + a * b * a;
        double bResult = Math.pow(b, 3) / 3 - (a + b) * Math.pow(b, 2) / 2 + a * b * b;
        System.out.println(aResult - bResult);
    }
}
0