Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _19.BaseinTube
- {
- class Program
- {
- static void Main(string[] args)
- {
- int v = int.Parse(Console.ReadLine());
- int p1 = int.Parse(Console.ReadLine());
- int p2 = int.Parse(Console.ReadLine());
- double h = double.Parse(Console.ReadLine());
- if (p1 + p2 < v && v>= 1 && v<= 10000 && p1>=1 && p1<= 5000 && p2 >= 1 && p2 <= 5000 && h>= 1.0 && h<=24.0)
- {
- p1 = p1 * h;
- p2 = p2 * h;
- var filled = ((p1 + p2) * 100) / v;
- var Pipe1 = 100 * p1 / (p1 + p2);
- var Pipe2 = 100 * p2 / (p1 + p2);
- Console.WriteLine("The pool is {0}%full. Pipe 1 : {1}%. Pipe 2: {2}%.", filled, Pipe1, Pipe2);
- }
- else if (p1 + p2 > v && v >= 1 && v <= 10000 && p1 >= 1 && p1 <= 5000 && p2 >= 1 && p2 <= 5000 && h >= 1.0 && h <= 24.0)
- {
- p1 = p1 * h;
- p2 = p2 * h;
- var overflowed = (p1 + p2) - v;
- Console.WriteLine("For {0} hours the pool overflows with {1} liters.", h, overflowed);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement