Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace _2grupa_02SeizeTheFire
- {
- class Program
- {
- static void Main(string[] args)
- {
- var cells = Console.ReadLine().Split("#").ToArray();
- int water = int.Parse(Console.ReadLine());
- int totalFire = 0;
- double effort = 0.00;
- Console.WriteLine("Cells:");
- foreach (var cell in cells)
- {
- var cellsParts = cell.Split(" = ");
- var typeOfFire = cellsParts[0];
- var value = int.Parse(cellsParts[1]);
- var isValid = (water >= value) &&
- ((typeOfFire == "High" && value >= 81 && value <= 125) ||
- (typeOfFire == "Medium" && value >= 51 && value <= 80) ||
- (typeOfFire == "Low" && value >= 1 && value <= 50));
- if (!isValid) { continue; }
- effort += 0.25 * value;
- totalFire += value;
- water -= value;
- Console.WriteLine($" - {value}");
- }
- Console.WriteLine($"Effort: {effort:f2}");
- Console.WriteLine($"Total Fire: {totalFire}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement