結果
問題 | No.959 tree and fire |
ユーザー | k_6101 |
提出日時 | 2020-02-12 21:44:56 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,050 bytes |
コンパイル時間 | 2,393 ms |
コンパイル使用メモリ | 91,300 KB |
実行使用メモリ | 54,476 KB |
最終ジャッジ日時 | 2024-10-04 03:45:27 |
合計ジャッジ時間 | 12,624 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 146 ms
53,992 KB |
testcase_01 | AC | 149 ms
53,836 KB |
testcase_02 | AC | 146 ms
54,268 KB |
testcase_03 | AC | 146 ms
54,004 KB |
testcase_04 | AC | 149 ms
53,912 KB |
testcase_05 | AC | 146 ms
53,708 KB |
testcase_06 | AC | 147 ms
54,156 KB |
testcase_07 | AC | 148 ms
53,948 KB |
testcase_08 | AC | 145 ms
54,256 KB |
testcase_09 | AC | 134 ms
53,544 KB |
testcase_10 | AC | 148 ms
53,996 KB |
testcase_11 | AC | 149 ms
54,116 KB |
testcase_12 | AC | 147 ms
53,972 KB |
testcase_13 | AC | 146 ms
54,028 KB |
testcase_14 | AC | 146 ms
53,748 KB |
testcase_15 | AC | 147 ms
53,748 KB |
testcase_16 | AC | 146 ms
54,164 KB |
testcase_17 | AC | 145 ms
53,988 KB |
testcase_18 | AC | 152 ms
54,060 KB |
testcase_19 | AC | 145 ms
54,204 KB |
testcase_20 | AC | 146 ms
53,648 KB |
testcase_21 | AC | 143 ms
53,980 KB |
testcase_22 | AC | 147 ms
53,900 KB |
testcase_23 | AC | 146 ms
54,312 KB |
testcase_24 | AC | 146 ms
54,292 KB |
testcase_25 | AC | 147 ms
53,836 KB |
testcase_26 | AC | 145 ms
54,060 KB |
testcase_27 | AC | 145 ms
53,884 KB |
testcase_28 | AC | 146 ms
53,888 KB |
testcase_29 | AC | 147 ms
54,204 KB |
testcase_30 | AC | 137 ms
53,836 KB |
testcase_31 | AC | 147 ms
53,888 KB |
testcase_32 | AC | 147 ms
53,972 KB |
testcase_33 | AC | 148 ms
54,228 KB |
testcase_34 | AC | 145 ms
54,316 KB |
testcase_35 | AC | 147 ms
54,380 KB |
testcase_36 | AC | 148 ms
54,192 KB |
testcase_37 | AC | 146 ms
54,324 KB |
testcase_38 | AC | 145 ms
54,028 KB |
testcase_39 | AC | 148 ms
53,796 KB |
testcase_40 | AC | 146 ms
54,476 KB |
testcase_41 | AC | 146 ms
53,772 KB |
testcase_42 | AC | 147 ms
53,768 KB |
testcase_43 | AC | 147 ms
53,756 KB |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | AC | 148 ms
53,816 KB |
testcase_55 | AC | 146 ms
54,288 KB |
testcase_56 | AC | 146 ms
54,176 KB |
ソースコード
import java.awt.Robot; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.InputStream; import java.io.PrintWriter; import java.lang.reflect.Array; import java.math.BigDecimal; import java.math.MathContext; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Objects; import java.util.PriorityQueue; import java.util.Queue; import java.util.Random; import java.util.Scanner; import java.util.Set; import java.util.Stack; import java.util.TreeMap; import java.util.TreeSet; import static java.util.Comparator.*; public class Main { public static void main(String[] args) { PrintWriter out = new PrintWriter(System.out); Solver solver = new Solver(System.in, out); solver.solve(); out.close(); } } class Solver { Scanner sc; PrintWriter out; public Solver(InputStream in, PrintWriter out) { sc = new Scanner(in); this.out = out; } // ====================================================================== public void solve() { int N = ni(); int M = ni(); double P = sc.nextDouble(); double P2 = P * P; double P3 = P2 * P; double P4 = P3 * P; double P5 = P4 * P; double ans; if(P == 0) out.println((long)N * M); else if(P == 1) out.println(0); else if(N == 1 && M == 1) out.println(P); else if(N == 1) { ans = P2 * 2 + P3 * (M - 2); out.println(ans); } else if(M == 1) { ans = P2 * 2 + P3 * (N - 2); out.println(ans); } else { ans = P3 * 4 + P4 * (N - 2) * 2 + P4 * (M - 2) * 2 + P5 * (N - 2) * (M - 2); out.println(ans); } } // ------------------------------------------ // 入力 // ------------------------------------------ public int ni() { return sc.nextInt(); } public long nl() { return sc.nextLong(); } public String ns() { return sc.next(); } public char[] nc() { return sc.next().toCharArray(); } public int[] ndi(int N) { int[] ans = new int[N]; for (int i = 0; i < N; i++) { ans[i] = ni(); } return ans; } public long[] ndl(int N) { long[] ans = new long[N]; for (int i = 0; i < N; i++) { ans[i] = nl(); } return ans; } public String[] nds(int N) { String[] ans = new String[N]; for (int i = 0; i < N; i++) { ans[i] = ns(); } return ans; } public char[][] ndc(int N) { char[][] ans = new char[N][]; for (int i = 0; i < N; i++) { ans[i] = nc(); } return ans; } public int[][] nddi(int N, int S) { int[][] ans = new int[N][S]; for (int i = 0; i < N; i++) { for (int j = 0; j < S; j++) { ans[i][j] = ni(); } } return ans; } }