結果

問題 No.928 軽減税率?
ユーザー tsushimatsushima
提出日時 2019-11-22 23:17:27
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,162 bytes
コンパイル時間 723 ms
コンパイル使用メモリ 110,700 KB
実行使用メモリ 32,208 KB
最終ジャッジ日時 2024-04-19 12:33:23
合計ジャッジ時間 3,795 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
32,208 KB
testcase_01 WA -
testcase_02 AC 23 ms
24,864 KB
testcase_03 AC 24 ms
25,240 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 23 ms
24,880 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 24 ms
25,208 KB
testcase_11 WA -
testcase_12 AC 26 ms
25,204 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int P = l[0], Q = l[1], A = l[2];

            var min = 0;
            var max = 1000000000;
            var mid = max / 2;

            while (mid > 0)
            {
                var eat = EatStore(P, mid);
                var takeout = TakeOut(Q, mid, A);

                if (eat < takeout)
                {
                    min = mid + 1;
                    mid = (min + max) / 2;
                }
                else
                {
                    max = mid - 1;
                    mid = min + (max - min) / 2;
                }

                if (min == max && min == mid) break;
            }

            Console.WriteLine(max);
        }

        static int EatStore(double p, int x)
        {
            return (int)((1 + (p / 100)) * x);
        }

        static int TakeOut(double q, int x, int a)
        {
            return (int)((1 + q / 100) * x) + a;
        }
    }
}
0