結果
問題 | No.959 tree and fire |
ユーザー | k_6101 |
提出日時 | 2020-02-12 21:47:18 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 142 ms / 2,000 ms |
コード長 | 3,050 bytes |
コンパイル時間 | 2,773 ms |
コンパイル使用メモリ | 90,904 KB |
実行使用メモリ | 55,244 KB |
最終ジャッジ日時 | 2024-10-04 03:47:59 |
合計ジャッジ時間 | 10,893 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 125 ms
53,308 KB |
testcase_01 | AC | 126 ms
54,196 KB |
testcase_02 | AC | 125 ms
53,900 KB |
testcase_03 | AC | 128 ms
54,336 KB |
testcase_04 | AC | 125 ms
54,216 KB |
testcase_05 | AC | 125 ms
54,304 KB |
testcase_06 | AC | 121 ms
53,992 KB |
testcase_07 | AC | 124 ms
54,276 KB |
testcase_08 | AC | 124 ms
54,072 KB |
testcase_09 | AC | 108 ms
53,236 KB |
testcase_10 | AC | 132 ms
54,444 KB |
testcase_11 | AC | 120 ms
54,252 KB |
testcase_12 | AC | 123 ms
53,632 KB |
testcase_13 | AC | 121 ms
54,504 KB |
testcase_14 | AC | 125 ms
54,052 KB |
testcase_15 | AC | 126 ms
54,568 KB |
testcase_16 | AC | 128 ms
54,240 KB |
testcase_17 | AC | 121 ms
54,216 KB |
testcase_18 | AC | 110 ms
53,272 KB |
testcase_19 | AC | 120 ms
54,152 KB |
testcase_20 | AC | 123 ms
53,932 KB |
testcase_21 | AC | 125 ms
54,464 KB |
testcase_22 | AC | 123 ms
53,864 KB |
testcase_23 | AC | 114 ms
52,988 KB |
testcase_24 | AC | 108 ms
53,120 KB |
testcase_25 | AC | 116 ms
53,372 KB |
testcase_26 | AC | 110 ms
53,148 KB |
testcase_27 | AC | 129 ms
54,004 KB |
testcase_28 | AC | 122 ms
54,088 KB |
testcase_29 | AC | 111 ms
53,188 KB |
testcase_30 | AC | 132 ms
53,888 KB |
testcase_31 | AC | 142 ms
54,456 KB |
testcase_32 | AC | 127 ms
54,256 KB |
testcase_33 | AC | 124 ms
54,176 KB |
testcase_34 | AC | 124 ms
53,816 KB |
testcase_35 | AC | 120 ms
54,268 KB |
testcase_36 | AC | 133 ms
54,396 KB |
testcase_37 | AC | 132 ms
53,996 KB |
testcase_38 | AC | 121 ms
54,204 KB |
testcase_39 | AC | 120 ms
54,196 KB |
testcase_40 | AC | 120 ms
54,340 KB |
testcase_41 | AC | 116 ms
53,688 KB |
testcase_42 | AC | 118 ms
53,484 KB |
testcase_43 | AC | 131 ms
53,980 KB |
testcase_44 | AC | 121 ms
52,980 KB |
testcase_45 | AC | 122 ms
53,992 KB |
testcase_46 | AC | 119 ms
53,916 KB |
testcase_47 | AC | 125 ms
54,036 KB |
testcase_48 | AC | 133 ms
54,536 KB |
testcase_49 | AC | 118 ms
55,244 KB |
testcase_50 | AC | 135 ms
54,196 KB |
testcase_51 | AC | 126 ms
54,512 KB |
testcase_52 | AC | 110 ms
53,116 KB |
testcase_53 | AC | 139 ms
54,328 KB |
testcase_54 | AC | 138 ms
53,868 KB |
testcase_55 | AC | 121 ms
54,332 KB |
testcase_56 | AC | 122 ms
53,920 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(0); else if(P == 1) out.println((long)N * M); 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; } }