結果

問題 No.604 誕生日のお小遣い
ユーザー bluemeganebluemegane
提出日時 2018-09-22 20:00:58
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 815 bytes
コンパイル時間 2,299 ms
コンパイル使用メモリ 102,796 KB
実行使用メモリ 24,860 KB
最終ジャッジ日時 2023-09-25 15:24:08
合計ジャッジ時間 5,331 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 55 ms
20,700 KB
testcase_02 AC 55 ms
20,688 KB
testcase_03 AC 56 ms
20,684 KB
testcase_04 AC 56 ms
22,716 KB
testcase_05 AC 57 ms
20,648 KB
testcase_06 AC 57 ms
22,744 KB
testcase_07 AC 56 ms
20,808 KB
testcase_08 AC 56 ms
20,720 KB
testcase_09 AC 56 ms
20,876 KB
testcase_10 AC 56 ms
20,700 KB
testcase_11 AC 58 ms
22,784 KB
testcase_12 AC 57 ms
20,796 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 56 ms
18,784 KB
testcase_16 AC 56 ms
20,792 KB
testcase_17 AC 56 ms
20,820 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = long.Parse(line[0]);
        var b = long.Parse(line[1]);
        var c = long.Parse(line[2]);
        var res = getAns(a, b, c);
        Console.WriteLine(res);
    }
    public static long getAns(long a, long b, long c)
    {
        if (a == 1 | c == 1) return 1;
        var ng = 1L; var ok = 1000000000000000000L;
        while (ok - ng > 1)
        {
            var mid = ng + (ok - ng) / 2;
            if (check(a, b, c, mid)) ok = mid;
            else ng = mid;
        }
        return ok;
    }
    public static bool check(long a, long b, long c, long t)
    {
        var w1 = t / a;
        var w2 = w1 * b + t - w1;
        return w2 >= c;
    }
}
0