結果
問題 | No.959 tree and fire |
ユーザー |
![]() |
提出日時 | 2021-02-02 03:07:21 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 1,071 bytes |
コンパイル時間 | 677 ms |
コンパイル使用メモリ | 111,116 KB |
実行使用メモリ | 20,352 KB |
最終ジャッジ日時 | 2024-06-29 23:35:02 |
合計ジャッジ時間 | 3,411 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 54 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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);}}