結果
問題 |
No.928 軽減税率?
|
ユーザー |
![]() |
提出日時 | 2019-11-22 23:17:27 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,162 bytes |
コンパイル時間 | 2,821 ms |
コンパイル使用メモリ | 110,416 KB |
実行使用メモリ | 31,676 KB |
最終ジャッジ日時 | 2024-10-11 04:51:58 |
合計ジャッジ時間 | 6,062 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 5 WA * 12 TLE * 1 -- * 16 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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; } } }