結果

問題 No.604 誕生日のお小遣い
ユーザー bluemeganebluemegane
提出日時 2021-04-24 10:33:10
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 58 ms / 1,000 ms
コード長 659 bytes
コンパイル時間 755 ms
コンパイル使用メモリ 64,948 KB
実行使用メモリ 22,700 KB
最終ジャッジ日時 2023-09-17 13:32:53
合計ジャッジ時間 3,179 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
20,764 KB
testcase_01 AC 57 ms
20,640 KB
testcase_02 AC 57 ms
18,628 KB
testcase_03 AC 57 ms
20,908 KB
testcase_04 AC 56 ms
18,476 KB
testcase_05 AC 57 ms
20,724 KB
testcase_06 AC 57 ms
20,716 KB
testcase_07 AC 57 ms
20,804 KB
testcase_08 AC 57 ms
20,912 KB
testcase_09 AC 58 ms
22,632 KB
testcase_10 AC 57 ms
20,636 KB
testcase_11 AC 57 ms
22,644 KB
testcase_12 AC 57 ms
20,688 KB
testcase_13 AC 57 ms
18,612 KB
testcase_14 AC 57 ms
20,896 KB
testcase_15 AC 58 ms
22,700 KB
testcase_16 AC 58 ms
22,568 KB
testcase_17 AC 58 ms
20,704 KB
testcase_18 AC 57 ms
20,792 KB
testcase_19 AC 57 ms
20,784 KB
testcase_20 AC 57 ms
20,584 KB
testcase_21 AC 57 ms
20,736 KB
testcase_22 AC 58 ms
20,520 KB
testcase_23 AC 57 ms
20,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

public class Hello
{
    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]);
        getAns(a, b, c);
    }
    static void getAns(long a, long b, long c)
    {
        var s = a + b - 1;
        var t = c / s;
        if (t == 0)
        {
            if (a - 1 >= c) Console.WriteLine(c);
            else Console.WriteLine(a);
            return;
        }
        var t2 = c % s;
        if (t * s + a - 1 >= c) Console.WriteLine(t * a + t2);
        else Console.WriteLine(t * a + a);
    }
}
0