結果

問題 No.604 誕生日のお小遣い
ユーザー mbanmban
提出日時 2017-12-15 16:45:58
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 3,641 bytes
コンパイル時間 2,252 ms
コンパイル使用メモリ 107,800 KB
実行使用メモリ 24,936 KB
最終ジャッジ日時 2023-08-21 06:43:00
合計ジャッジ時間 4,831 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 55 ms
20,864 KB
testcase_02 AC 55 ms
18,788 KB
testcase_03 AC 56 ms
22,896 KB
testcase_04 AC 56 ms
22,740 KB
testcase_05 AC 56 ms
20,712 KB
testcase_06 AC 56 ms
22,752 KB
testcase_07 AC 56 ms
22,836 KB
testcase_08 AC 55 ms
20,828 KB
testcase_09 AC 56 ms
22,752 KB
testcase_10 AC 55 ms
18,776 KB
testcase_11 AC 56 ms
20,728 KB
testcase_12 AC 56 ms
20,724 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 56 ms
22,756 KB
testcase_16 AC 56 ms
22,692 KB
testcase_17 AC 56 ms
22,896 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;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Scanner
{
    private readonly char Separator = ' ';
    private int Index = 0;
    private string[] Line = new string[0];
    public string Next()
    {
        if (Index >= Line.Length)
        {
            Line = Console.ReadLine().Split(Separator);
            Index = 0;
        }
        var ret = Line[Index];
        Index++;
        return ret;
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public string[] StringArray()
    {
        Line = Console.ReadLine().Split(Separator);
        Index = Line.Length;
        return Line;
    }

    public int[] IntArray()
    {
        var l = StringArray();
        var res = new int[l.Length];
        for (int i = 0; i < l.Length; i++)
        {
            res[i] = int.Parse(l[i]);
        }
        return res;
    }

    public long[] LongArray()
    {
        var l = StringArray();
        var res = new long[l.Length];
        for (int i = 0; i < l.Length; i++)
        {
            res[i] = long.Parse(l[i]);
        }
        return res;
    }
}

struct S
{
    public int Begin, End, Length;
    public S(int b, int e)
    {
        Begin = b;
        End = e;
        Length = e - b + 1;
    }
}

class SegmentTree<T>
{
    private T[] Array;
    private readonly int N;
    private Comparison<T> Comparison;
    private readonly T Min;
    public SegmentTree(int length, T min) : this(length, min, Comparer<T>.Default) { }
    public SegmentTree(int length, T min, IComparer<T> comparer) : this(length, min, comparer.Compare) { }
    public SegmentTree(int length, T min, Comparison<T> comparison)
    {
        for (N = 1; N < length; N *= 2) ;
        Array = new T[N * 2];
        Min = min;
        for (int i = 1; i < N * 2; i++)
        {
            Array[i] = Min;
        }
        Comparison = comparison;
    }

    private T Max(T a, T b)
    {
        if (Comparison(a, b) >= 0)
        {
            return a;
        }
        else
        {
            return b;
        }
    }

    public void Update(int index, T value)
    {
        index += N;
        Array[index] = value;
        for (index = index / 2; index > 0; index /= 2)
        {
            Array[index] = Max(Array[index * 2], Array[index * 2 + 1]);
        }
    }

    private T Query(int a, int b, int k, int l, int r)
    {
        if (a <= l && r <= b)
        {
            return Array[k];
        }
        if (b <= l || r <= a)
        {
            return Min;
        }
        T left = Query(a, b, k * 2, l, (l + r) / 2);
        T right = Query(a, b, k * 2 + 1, (l + r) / 2, r);
        return Max(left, right);
    }

    public T Query(int a, int b)
    {
        return Query(a, b, 1, 0, N);
    }
}

class Program
{
    private long A, B, C;
    private void Scan()
    {
        var sc = new Scanner();
        A = sc.NextLong();
        B = sc.NextLong();
        C = sc.NextLong();
    }

    public void Solve()
    {
        Scan();
        long min = 0;
        long max = (long)1e18 + 1;
        while (max - min > 1)
        {
            long mid = (min + max) / 2;
            if (F(mid) >= C)
            {
                max = mid;
            }
            else
            {
                min = mid;
            }
        }
        Console.WriteLine(max);
    }

    public long F(long y)
    {
        return y + ((y / A) * (B - 1));
    }

    static void Main(string[] args)
    {
        new Program().Solve();
    }
}
0