結果

問題 No.959 tree and fire
ユーザー keymoonkeymoon
提出日時 2021-02-02 03:07:21
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 1,071 bytes
コンパイル時間 2,018 ms
コンパイル使用メモリ 100,736 KB
実行使用メモリ 26,540 KB
最終ジャッジ日時 2023-09-12 10:58:40
合計ジャッジ時間 9,029 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
24,348 KB
testcase_01 AC 69 ms
26,356 KB
testcase_02 AC 68 ms
24,428 KB
testcase_03 AC 70 ms
24,428 KB
testcase_04 AC 69 ms
24,224 KB
testcase_05 AC 70 ms
24,356 KB
testcase_06 AC 69 ms
24,372 KB
testcase_07 AC 69 ms
24,320 KB
testcase_08 AC 69 ms
24,376 KB
testcase_09 AC 69 ms
26,272 KB
testcase_10 AC 69 ms
22,348 KB
testcase_11 AC 69 ms
24,392 KB
testcase_12 AC 68 ms
22,308 KB
testcase_13 AC 69 ms
24,308 KB
testcase_14 AC 68 ms
24,312 KB
testcase_15 AC 68 ms
24,332 KB
testcase_16 AC 70 ms
26,472 KB
testcase_17 AC 70 ms
26,400 KB
testcase_18 AC 69 ms
24,360 KB
testcase_19 AC 69 ms
24,376 KB
testcase_20 AC 70 ms
26,500 KB
testcase_21 AC 70 ms
24,432 KB
testcase_22 AC 69 ms
24,248 KB
testcase_23 AC 70 ms
24,472 KB
testcase_24 AC 69 ms
22,360 KB
testcase_25 AC 69 ms
24,272 KB
testcase_26 AC 69 ms
24,444 KB
testcase_27 AC 69 ms
24,484 KB
testcase_28 AC 69 ms
26,220 KB
testcase_29 AC 70 ms
24,404 KB
testcase_30 AC 69 ms
24,304 KB
testcase_31 AC 70 ms
26,380 KB
testcase_32 AC 71 ms
26,432 KB
testcase_33 AC 69 ms
24,444 KB
testcase_34 AC 69 ms
24,404 KB
testcase_35 AC 70 ms
24,360 KB
testcase_36 AC 70 ms
24,304 KB
testcase_37 AC 70 ms
26,540 KB
testcase_38 AC 69 ms
26,368 KB
testcase_39 AC 69 ms
24,440 KB
testcase_40 AC 70 ms
24,368 KB
testcase_41 AC 70 ms
24,420 KB
testcase_42 AC 71 ms
24,224 KB
testcase_43 AC 69 ms
22,324 KB
testcase_44 AC 67 ms
24,168 KB
testcase_45 AC 67 ms
24,156 KB
testcase_46 AC 68 ms
22,240 KB
testcase_47 AC 66 ms
22,168 KB
testcase_48 AC 66 ms
24,164 KB
testcase_49 AC 69 ms
26,288 KB
testcase_50 AC 69 ms
24,276 KB
testcase_51 AC 69 ms
24,232 KB
testcase_52 AC 69 ms
24,208 KB
testcase_53 AC 69 ms
22,216 KB
testcase_54 AC 68 ms
24,300 KB
testcase_55 AC 69 ms
24,400 KB
testcase_56 AC 69 ms
22,280 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        var nm = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var n = nm.Min();
        var m = nm.Max();
        var p = double.Parse(Console.ReadLine());
        var cnts = new long[5];
        if (n == 1)
        {
            if (m == 1)
            {
                cnts[0] = 1;
            }
            else
            {
                cnts[1] = 2;
                cnts[2] = m - 2;
            }
        }
        else
        {
            cnts[2] = 4;
            cnts[3] = (n - 2) * 2 + (m - 2) * 2;
            cnts[4] = (n - 2) * (m - 2);
        }
        double res = 0;
        for (int i = 0; i < cnts.Length; i++)
            res += p * Pow(p, i) * cnts[i];
        Console.WriteLine(res);
    }
}
0