結果

問題 No.2420 Simple Problem
ユーザー bluemeganebluemegane
提出日時 2023-08-19 16:52:17
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 1,417 ms / 2,000 ms
コード長 844 bytes
コンパイル時間 989 ms
コンパイル使用メモリ 107,012 KB
実行使用メモリ 28,324 KB
最終ジャッジ日時 2023-12-14 14:32:18
合計ジャッジ時間 44,794 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
24,152 KB
testcase_01 AC 582 ms
28,324 KB
testcase_02 AC 30 ms
24,152 KB
testcase_03 AC 230 ms
28,324 KB
testcase_04 AC 1,112 ms
28,324 KB
testcase_05 AC 711 ms
28,324 KB
testcase_06 AC 1,377 ms
28,324 KB
testcase_07 AC 1,417 ms
28,324 KB
testcase_08 AC 1,383 ms
28,324 KB
testcase_09 AC 1,402 ms
28,324 KB
testcase_10 AC 1,386 ms
28,324 KB
testcase_11 AC 1,383 ms
28,324 KB
testcase_12 AC 1,376 ms
28,324 KB
testcase_13 AC 1,380 ms
28,324 KB
testcase_14 AC 1,379 ms
28,324 KB
testcase_15 AC 1,379 ms
28,324 KB
testcase_16 AC 1,380 ms
28,324 KB
testcase_17 AC 1,414 ms
28,324 KB
testcase_18 AC 1,378 ms
28,324 KB
testcase_19 AC 1,386 ms
28,324 KB
testcase_20 AC 1,397 ms
28,324 KB
testcase_21 AC 1,381 ms
28,324 KB
testcase_22 AC 1,389 ms
28,324 KB
testcase_23 AC 1,382 ms
28,324 KB
testcase_24 AC 1,384 ms
28,324 KB
testcase_25 AC 1,369 ms
28,324 KB
testcase_26 AC 24 ms
24,152 KB
testcase_27 AC 1,097 ms
28,324 KB
testcase_28 AC 1,101 ms
28,324 KB
testcase_29 AC 1,111 ms
28,324 KB
testcase_30 AC 1,112 ms
28,324 KB
testcase_31 AC 1,117 ms
28,324 KB
testcase_32 AC 24 ms
24,152 KB
testcase_33 AC 581 ms
28,324 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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
{
    static void Main()
    {
        var T = int.Parse(Console.ReadLine().Trim());
        while (T-- > 0)
        {

            string[] line = Console.ReadLine().Trim().Split(' ');
            var a = long.Parse(line[0]);
            var b = long.Parse(line[1]);
            getAns(a, b);
        }
    }
    static bool check(long a, long b, long t)
    {
        var w = t * t - a - b;
        return 4 * a * b < w * w;
    }
    static void getAns(long a, long b)
    {
        var ok = (long)Sqrt(a) + (long)Sqrt(b) + 10;
        var ng = (long)Sqrt(a) + (long)Sqrt(b) - 1;
        while (ok - ng > 1)
        {
            var mid = ng + (ok - ng) / 2L;
            if (check(a, b, mid)) ok = mid;
            else ng = mid;
        }
        Console.WriteLine(ok);
    }
}
0