結果

問題 No.1350 2019-6problem
ユーザー bluemeganebluemegane
提出日時 2021-05-18 20:13:55
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 776 bytes
コンパイル時間 1,745 ms
コンパイル使用メモリ 103,808 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2024-04-17 08:07:05
合計ジャッジ時間 2,449 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
17,920 KB
testcase_01 AC 21 ms
17,920 KB
testcase_02 AC 22 ms
17,664 KB
testcase_03 AC 21 ms
17,664 KB
testcase_04 AC 20 ms
17,536 KB
testcase_05 AC 22 ms
17,664 KB
testcase_06 AC 23 ms
17,664 KB
testcase_07 AC 24 ms
17,664 KB
testcase_08 AC 23 ms
17,792 KB
testcase_09 AC 22 ms
17,920 KB
testcase_10 AC 22 ms
17,792 KB
testcase_11 AC 22 ms
17,792 KB
testcase_12 AC 21 ms
17,664 KB
testcase_13 WA -
testcase_14 AC 20 ms
17,920 KB
testcase_15 AC 21 ms
17,664 KB
testcase_16 AC 22 ms
17,536 KB
testcase_17 WA -
testcase_18 AC 22 ms
17,664 KB
testcase_19 AC 21 ms
17,792 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 21 ms
17,920 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
{
    public static long a, b, k;
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        a = long.Parse(line[0]);
        b = long.Parse(line[1]);
        k = long.Parse(line[2]);
        getAns();
    }
    static bool check(long t) => t / a + t / b - t / a / b >= k;
    static void getAns()
    {
        if (k == 1) { Console.WriteLine(Min(a, b)); return; }
        if (k == 2) { Console.WriteLine(Max(a, b)); return; }
        var ok = long.MaxValue;
        var ng = 1L;
        while (ok - ng > 1)
        {
            var mid = ng + (ok - ng) / 2L;
            if (check(mid)) ok = mid;
            else ng = mid;
        }
        Console.WriteLine(ok);
    }
}
0