結果
問題 | No.813 ユキちゃんの冒険 |
ユーザー |
|
提出日時 | 2019-04-13 18:38:34 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,595 bytes |
コンパイル時間 | 2,601 ms |
コンパイル使用メモリ | 114,780 KB |
実行使用メモリ | 29,592 KB |
最終ジャッジ日時 | 2025-01-02 06:33:54 |
合計ジャッジ時間 | 4,286 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 WA * 10 |
コンパイルメッセージ
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.Generic; using System.Linq; using System.Text; using static System.Console; using static System.Math; namespace AtTest.yukicoder { class _813 { static void Main(string[] args) { Method(args); } static void Method(string[] args) { int n = ReadInt(); double p = ReadDouble(); double q = ReadDouble(); if (p == 1) { WriteLine(1); return; } if (q == 1) { WriteLine(0); return; } double back = p; double go=q; for(int i = 1; i < n; i++) { back = back + p * go * go / (1 - back * p); go = go * q / (1 - back * p); } WriteLine(back); } private static string Read() { return ReadLine(); } private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); } private static int ReadInt() { return int.Parse(Read()); } private static long ReadLong() { return long.Parse(Read()); } private static double ReadDouble() { return double.Parse(Read()); } private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); } private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); } private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); } } }