Spocoman

03. Harvest

Nov 16th, 2021 (edited)
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Harvest
  4. {
  5.     class Program
  6.     {
  7.         static void Main()
  8.         {
  9.             double x = double.Parse(Console.ReadLine());
  10.             double y = double.Parse(Console.ReadLine());
  11.             double z = double.Parse(Console.ReadLine());
  12.             int workers = int.Parse(Console.ReadLine());
  13.  
  14.             double wine = 0.4 * x * y / 2.5;
  15.  
  16.             if (wine < z)
  17.             {
  18.                 Console.WriteLine($"It will be a tough winter! More {Math.Floor(z - wine)} liters wine needed.");
  19.             }
  20.             else
  21.             {
  22.                 Console.WriteLine($"Good harvest this year! Total wine: {Math.Floor(wine)} liters.");
  23.                 Console.WriteLine($"{Math.Ceiling(wine - z)} liters left -> {Math.Ceiling((wine - z) / workers)} liters per person.");
  24.             }
  25.         }
  26.     }
  27. }
Add Comment
Please, Sign In to add comment