結果

問題 No.959 tree and fire
ユーザー htensaihtensai
提出日時 2020-01-18 19:33:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 1,107 bytes
コンパイル時間 2,208 ms
コンパイル使用メモリ 73,880 KB
実行使用メモリ 51,328 KB
最終ジャッジ日時 2023-09-10 10:15:59
合計ジャッジ時間 7,581 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
49,512 KB
testcase_01 AC 46 ms
49,716 KB
testcase_02 AC 46 ms
49,560 KB
testcase_03 AC 46 ms
49,524 KB
testcase_04 AC 46 ms
49,536 KB
testcase_05 AC 45 ms
47,896 KB
testcase_06 AC 45 ms
48,096 KB
testcase_07 AC 47 ms
49,292 KB
testcase_08 AC 47 ms
49,404 KB
testcase_09 AC 47 ms
49,492 KB
testcase_10 AC 46 ms
49,496 KB
testcase_11 AC 46 ms
49,608 KB
testcase_12 AC 46 ms
49,420 KB
testcase_13 AC 46 ms
51,328 KB
testcase_14 AC 46 ms
49,552 KB
testcase_15 AC 45 ms
49,408 KB
testcase_16 AC 45 ms
49,520 KB
testcase_17 AC 45 ms
49,508 KB
testcase_18 AC 45 ms
49,540 KB
testcase_19 AC 45 ms
49,528 KB
testcase_20 AC 44 ms
49,512 KB
testcase_21 AC 45 ms
49,548 KB
testcase_22 AC 46 ms
49,592 KB
testcase_23 AC 47 ms
49,500 KB
testcase_24 AC 47 ms
49,500 KB
testcase_25 AC 47 ms
49,592 KB
testcase_26 AC 47 ms
50,072 KB
testcase_27 AC 45 ms
49,548 KB
testcase_28 AC 46 ms
49,524 KB
testcase_29 AC 46 ms
49,444 KB
testcase_30 AC 47 ms
49,444 KB
testcase_31 AC 46 ms
49,292 KB
testcase_32 AC 46 ms
49,520 KB
testcase_33 AC 45 ms
50,016 KB
testcase_34 AC 45 ms
49,564 KB
testcase_35 AC 47 ms
49,516 KB
testcase_36 AC 46 ms
49,372 KB
testcase_37 AC 45 ms
49,876 KB
testcase_38 AC 46 ms
49,532 KB
testcase_39 AC 46 ms
49,428 KB
testcase_40 AC 47 ms
49,436 KB
testcase_41 AC 46 ms
49,416 KB
testcase_42 AC 47 ms
50,004 KB
testcase_43 AC 46 ms
49,296 KB
testcase_44 AC 44 ms
49,792 KB
testcase_45 AC 45 ms
49,544 KB
testcase_46 AC 45 ms
50,036 KB
testcase_47 AC 46 ms
49,808 KB
testcase_48 AC 46 ms
49,532 KB
testcase_49 AC 47 ms
47,804 KB
testcase_50 AC 46 ms
49,612 KB
testcase_51 AC 47 ms
49,644 KB
testcase_52 AC 46 ms
49,356 KB
testcase_53 AC 45 ms
47,884 KB
testcase_54 AC 46 ms
49,544 KB
testcase_55 AC 45 ms
49,816 KB
testcase_56 AC 47 ms
49,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] line = br.readLine().split(" ", 3);
        double n = Integer.parseInt(line[0]);
        double m = Integer.parseInt(line[1]);
        double p = Double.parseDouble(br.readLine());
        if (n == 1 && m == 1) {
            System.out.println(p);
            return;
        } else if (n == 1) {
            double ans = 0;
            ans += Math.pow(p, 2) * 2;
            ans += Math.pow(p, 3) * (m - 2);
            System.out.println(ans);
            return;
        } else if (m == 1) {
            double ans = 0;
            ans += Math.pow(p, 2) * 2;
            ans += Math.pow(p, 3) * (n - 2);
            System.out.println(ans);
            return;
        }
        double ans = 0;
        ans += Math.pow(p, 3) * 4;
        ans += Math.pow(p, 4) * ((n - 2) * 2 + (m - 2) * 2);
        ans += Math.pow(p, 5) * (n - 2) * (m - 2);
        System.out.println(ans);
    }
}
0