SHARE
TWEET

Тръби в басейн C#

kolioi Sep 29th, 2017 12 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace Pool
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int V = int.Parse(Console.ReadLine()),
  10.                 P1 = int.Parse(Console.ReadLine()),
  11.                 P2 = int.Parse(Console.ReadLine());
  12.  
  13.             double H = double.Parse(Console.ReadLine());
  14.  
  15.             double V1 = P1 * H,
  16.                    V2 = P2 * H;
  17.  
  18.             if (V1 + V2 <= V)
  19.             {
  20.                 int x = (int)((V1 + V2) * 100.0 / V),
  21.                     y = (int)(V1 * 100.0 / (V1 + V2)),
  22.                     z = (int)(V2 * 100.0 / (V1 + V2));
  23.                 Console.WriteLine($"The pool is {x}% full. Pipe 1: {y}%. Pipe 2: {z}%.");
  24.             }
  25.             else
  26.             {
  27.                 Console.WriteLine($"For {H} hours the pool overflows with {V1 + V2 - V:F1} liters.");
  28.             }
  29.         }
  30.     }
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top