結果

問題 No.604 誕生日のお小遣い
ユーザー bluemeganebluemegane
提出日時 2018-09-22 20:07:29
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 847 bytes
コンパイル時間 4,499 ms
コンパイル使用メモリ 100,140 KB
実行使用メモリ 24,968 KB
最終ジャッジ日時 2023-09-25 15:31:18
合計ジャッジ時間 5,058 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 59 ms
22,724 KB
testcase_02 AC 58 ms
22,824 KB
testcase_03 AC 59 ms
20,800 KB
testcase_04 AC 59 ms
20,784 KB
testcase_05 AC 58 ms
20,772 KB
testcase_06 AC 58 ms
22,820 KB
testcase_07 AC 58 ms
20,716 KB
testcase_08 AC 59 ms
22,728 KB
testcase_09 AC 58 ms
20,772 KB
testcase_10 AC 59 ms
20,792 KB
testcase_11 AC 57 ms
18,708 KB
testcase_12 AC 59 ms
20,720 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 58 ms
20,668 KB
testcase_16 AC 59 ms
22,816 KB
testcase_17 AC 58 ms
20,832 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 ( c == 1) return 1;
        if (a == 1 && b >= c) return 1;
        var ng = 1L; var ok = 1000000000000000001L;
        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