結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 56 ms
20,760 KB
testcase_02 AC 57 ms
22,744 KB
testcase_03 AC 58 ms
20,632 KB
testcase_04 AC 58 ms
22,784 KB
testcase_05 AC 58 ms
20,608 KB
testcase_06 AC 58 ms
20,672 KB
testcase_07 AC 57 ms
20,768 KB
testcase_08 AC 57 ms
20,612 KB
testcase_09 AC 57 ms
20,744 KB
testcase_10 AC 58 ms
20,764 KB
testcase_11 AC 57 ms
20,672 KB
testcase_12 AC 57 ms
20,744 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 58 ms
22,720 KB
testcase_16 AC 58 ms
22,820 KB
testcase_17 AC 56 ms
20,664 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 = 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