Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace Seize_the_Fire_MidExam_10thOfMarch2019
- {
- class Program
- {
- static void Main(string[] args)
- {
- var fireCells = Console.ReadLine()
- .Split("#").ToArray();
- double water = double.Parse(Console.ReadLine());
- double totalFire = 0;
- double effortsTotal = 0;
- bool isValid = false;
- var cells = new List<double>();
- for (int i = 0; i < fireCells.Length; i++)
- {
- var item = fireCells[i].Split(" = ");
- string typeOfFire = item[0];
- double value = int.Parse(item[1]);
- if (typeOfFire == "High")
- {
- if (value <= 125 && value >= 81)
- {
- isValid = true;
- cells.Add(value);
- }
- }
- else if (typeOfFire == "Medium")
- {
- if (value <= 80 && value >= 51)
- {
- isValid = true;
- cells.Add(value);
- }
- }
- else if (typeOfFire == "Low")
- {
- if (value <= 50 && value >= 1)
- {
- isValid = true;
- cells.Add(value);
- }
- }
- else
- {
- isValid = false;
- continue;
- }
- if (isValid)
- {
- water -= value;
- totalFire += value;
- }
- double efforts = value * 0.25;
- effortsTotal += efforts;
- }
- Console.WriteLine("Cells:");
- //foreach (var cell in cells)
- //{
- // Console.WriteLine($"- {cell}");
- //}
- for (int i = 0; i < cells.Count; i++)
- {
- Console.WriteLine($"- {cells[i]}");
- }
- Console.WriteLine($"Efforts: {effortsTotal:f2}");
- Console.WriteLine($"Total Fire: {totalFire}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement