結果

問題 No.1009 面積の求め方
ユーザー tentententen
提出日時 2020-10-09 08:46:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 407 bytes
コンパイル時間 4,423 ms
コンパイル使用メモリ 71,500 KB
実行使用メモリ 57,720 KB
最終ジャッジ日時 2023-09-27 12:32:27
合計ジャッジ時間 5,897 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
55,972 KB
testcase_01 AC 125 ms
55,868 KB
testcase_02 AC 134 ms
55,920 KB
testcase_03 AC 133 ms
55,928 KB
testcase_04 AC 126 ms
55,860 KB
testcase_05 AC 123 ms
57,720 KB
testcase_06 AC 132 ms
56,024 KB
testcase_07 AC 134 ms
53,760 KB
testcase_08 AC 132 ms
55,492 KB
testcase_09 AC 133 ms
56,168 KB
testcase_10 AC 131 ms
56,028 KB
testcase_11 AC 131 ms
56,160 KB
testcase_12 AC 133 ms
55,752 KB
testcase_13 AC 132 ms
55,648 KB
testcase_14 AC 131 ms
55,640 KB
testcase_15 AC 133 ms
55,476 KB
testcase_16 AC 130 ms
55,776 KB
testcase_17 AC 130 ms
55,916 KB
testcase_18 AC 133 ms
56,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        double dif = (b - a) / 1000000.0;
        double ans = 0;
        for (double i = a; i < b; i += dif) {
            ans += (i - a) * (i - b) * dif;
        }
        System.out.println(Math.abs(ans));
    }
}
0