結果

問題 No.604 誕生日のお小遣い
ユーザー bluemeganebluemegane
提出日時 2018-09-22 20:21:52
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 848 bytes
コンパイル時間 2,371 ms
コンパイル使用メモリ 103,184 KB
実行使用メモリ 22,924 KB
最終ジャッジ日時 2023-09-25 15:50:36
合計ジャッジ時間 4,983 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 58 ms
20,624 KB
testcase_02 AC 58 ms
20,840 KB
testcase_03 AC 59 ms
20,600 KB
testcase_04 AC 58 ms
22,788 KB
testcase_05 AC 59 ms
22,660 KB
testcase_06 AC 58 ms
20,748 KB
testcase_07 AC 57 ms
20,680 KB
testcase_08 AC 58 ms
18,792 KB
testcase_09 AC 59 ms
22,760 KB
testcase_10 AC 59 ms
20,772 KB
testcase_11 AC 58 ms
18,628 KB
testcase_12 AC 59 ms
22,656 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 58 ms
20,660 KB
testcase_16 AC 59 ms
20,644 KB
testcase_17 AC 59 ms
22,780 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 = 0L; var ok = 1000000000000000111L;
        while (ok - ng > 1)
        {
            var mid = ng + (ok - ng) / 2L;
            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