結果

問題 No.598 オーバーフローファンタジー
ユーザー mbanmban
提出日時 2017-12-01 18:35:43
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 1,806 bytes
コンパイル時間 4,793 ms
コンパイル使用メモリ 103,348 KB
実行使用メモリ 22,916 KB
最終ジャッジ日時 2023-08-26 22:34:02
合計ジャッジ時間 6,369 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
20,772 KB
testcase_01 AC 59 ms
22,772 KB
testcase_02 AC 60 ms
18,752 KB
testcase_03 AC 61 ms
22,764 KB
testcase_04 AC 59 ms
20,828 KB
testcase_05 AC 59 ms
22,768 KB
testcase_06 AC 59 ms
20,872 KB
testcase_07 AC 60 ms
22,684 KB
testcase_08 AC 60 ms
20,716 KB
testcase_09 AC 59 ms
20,676 KB
testcase_10 AC 58 ms
20,852 KB
testcase_11 AC 59 ms
22,872 KB
testcase_12 AC 58 ms
18,724 KB
testcase_13 AC 59 ms
18,668 KB
testcase_14 AC 59 ms
22,872 KB
testcase_15 AC 60 ms
20,796 KB
testcase_16 AC 59 ms
20,852 KB
testcase_17 AC 59 ms
20,688 KB
testcase_18 AC 59 ms
22,824 KB
testcase_19 AC 61 ms
20,800 KB
testcase_20 AC 58 ms
20,880 KB
testcase_21 AC 58 ms
20,804 KB
testcase_22 AC 58 ms
20,676 KB
testcase_23 AC 60 ms
20,868 KB
testcase_24 AC 60 ms
20,788 KB
testcase_25 AC 62 ms
20,728 KB
testcase_26 AC 61 ms
20,788 KB
testcase_27 AC 59 ms
20,884 KB
testcase_28 AC 59 ms
20,860 KB
testcase_29 AC 59 ms
22,844 KB
testcase_30 AC 60 ms
22,916 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
    }
}

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

    public void Solve()
    {
        Scan();
        long OverFlow = 1L << (N - 1);
        long cntAttack = (X + A - 1) / A;
        long cntHeal = (OverFlow - X + B - 1) / B;
        Console.WriteLine(Math.Min(cntAttack, cntHeal));
    }

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