Advertisement
Spocoman

Renovation

Nov 24th, 2021 (edited)
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Renovation
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int x = int.Parse(Console.ReadLine());
  10.             int y = int.Parse(Console.ReadLine());
  11.             int nonPaint = int.Parse(Console.ReadLine());
  12.             double paint = x * y * 4 - (x * y * 4 * nonPaint / 100);
  13.             double sum = 0;
  14.             string painting = Console.ReadLine();
  15.  
  16.             while (painting != "Tired!")
  17.             {
  18.                 int partPaint = int.Parse(painting);
  19.                 sum += partPaint;
  20.                 if (sum >= paint)
  21.                 {
  22.                     break;
  23.                 }
  24.                 painting = Console.ReadLine();
  25.             }
  26.  
  27.             if (sum < paint)
  28.             {
  29.                 Console.WriteLine($"{paint - sum} quadratic m left.");
  30.             }
  31.             else if (sum == paint)
  32.             {
  33.                 Console.WriteLine("All walls are painted! Great job, Pesho!");
  34.             }
  35.             else
  36.             {
  37.                 Console.WriteLine($"All walls are painted and you have {sum - paint} l paint left!");
  38.             }
  39.         }
  40.     }
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement