結果

問題 No.1042 愚直大学
ユーザー bluemegane
提出日時 2020-12-12 13:11:06
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 791 bytes
コンパイル時間 896 ms
コンパイル使用メモリ 111,792 KB
実行使用メモリ 19,072 KB
最終ジャッジ日時 2024-09-19 21:55:40
合計ジャッジ時間 2,516 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using static System.Math;
using System;

public class hello
{
    public static int p, q;
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        p = int.Parse(line[0]);
        q = int.Parse(line[1]);
        getAns();

    }
    static bool calc(double t)
    {
        var p2 = (double)p;
        var q2 = (double)q;
        var c1 = t * t;
        var c2 = p2 + q2 * t * Log10(t) / Log10(2);
        return c1 - c2 <= 0d;
    }
    static void getAns()
    {
        var ok = 1d;
        var ng = 1000000000000000000d;
        var t = 0;
        while (t < 200)
        {
            var mid = ok + (ng - ok) / 2d;
            if (calc(mid)) ok = mid;
            else ng = mid;
            t++;
        }
        Console.WriteLine(ok);
    }
}
0