Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Numerics;
- using System.Collections.Generic;
- namespace MidExam2
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string> input = Console.ReadLine()
- .Split("#")
- .ToList();
- int totalWater = int.Parse(Console.ReadLine());
- List<int> totalTrueCells = new List<int>();
- bool isThereNoLeftWater = false;
- for (int i = 0; i < input.Count; i++)
- {
- List<string> splitedInput = input[i].Split(" ").ToList();
- string level = splitedInput[0];
- int cels = int.Parse(splitedInput[2]);
- switch (level)
- {
- case "High":
- if (cels>= 81 && cels <= 125)
- {
- totalWater -= cels;
- if (totalWater < 0)
- {
- isThereNoLeftWater = true;
- break;
- }
- totalTrueCells.Add(cels);
- }
- break;
- case "Medium":
- if (cels >= 51 && cels <= 80)
- {
- totalWater -= cels;
- if (totalWater < 0)
- {
- isThereNoLeftWater = true;
- break;
- }
- totalTrueCells.Add(cels);
- }
- break;
- case "Low":
- if (cels >= 1 && cels <= 50)
- {
- totalWater -= cels;
- if (totalWater < 0)
- {
- isThereNoLeftWater = true;
- break;
- }
- totalTrueCells.Add(cels);
- }
- break;
- }
- if (isThereNoLeftWater)
- {
- break;
- }
- }
- double totalFire = 0;
- Console.WriteLine("Cells:");
- for (int i = 0; i < totalTrueCells.Count; i++)
- {
- totalFire += totalTrueCells[i];
- Console.WriteLine($" - {totalTrueCells[i]}");
- }
- Console.WriteLine($"Effort: {totalFire / 4:f2}");
- Console.WriteLine($"Total Fire: {totalFire}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement