結果

問題 No.813 ユキちゃんの冒険
ユーザー Tomohiko HasegawaTomohiko Hasegawa
提出日時 2019-04-13 18:32:08
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,459 bytes
コンパイル時間 2,573 ms
コンパイル使用メモリ 65,500 KB
実行使用メモリ 26,772 KB
最終ジャッジ日時 2023-08-30 15:12:34
合計ジャッジ時間 5,046 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
22,736 KB
testcase_01 WA -
testcase_02 AC 64 ms
22,668 KB
testcase_03 AC 65 ms
22,660 KB
testcase_04 WA -
testcase_05 AC 64 ms
22,612 KB
testcase_06 AC 64 ms
22,652 KB
testcase_07 AC 64 ms
22,640 KB
testcase_08 AC 63 ms
22,728 KB
testcase_09 WA -
testcase_10 AC 62 ms
22,684 KB
testcase_11 WA -
testcase_12 AC 63 ms
24,596 KB
testcase_13 AC 62 ms
24,732 KB
testcase_14 WA -
testcase_15 AC 65 ms
22,656 KB
testcase_16 AC 63 ms
22,732 KB
testcase_17 WA -
testcase_18 AC 62 ms
24,720 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 63 ms
22,700 KB
testcase_24 AC 63 ms
22,684 KB
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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);
            if (q == 1) WriteLine(0);

            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); }
    }
}
0