結果
問題 | No.959 tree and fire |
ユーザー |
![]() |
提出日時 | 2021-02-02 03:06:30 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,051 bytes |
コンパイル時間 | 2,286 ms |
コンパイル使用メモリ | 114,808 KB |
実行使用メモリ | 28,344 KB |
最終ジャッジ日時 | 2024-06-29 23:34:57 |
合計ジャッジ時間 | 3,573 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 53 WA * 1 |
コンパイルメッセージ
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) { Console.WriteLine(0); return; } 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); } }