Advertisement
silvana1303

seize the fire

Jun 17th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.42 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Numerics;
  5. using System.Threading;
  6. using System.Transactions;
  7.  
  8. namespace exampreparation
  9. {
  10.     class exam
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             List<string> fire = Console.ReadLine().Split('#').ToList();
  15.  
  16.             double water = double.Parse(Console.ReadLine());
  17.  
  18.             List<int> finalFire = new List<int>();
  19.  
  20.             for (int i = 0; i < fire.Count; i++)
  21.             {
  22.                 string[] command = fire[i].Split(" = ").ToArray();
  23.  
  24.                 if (command[0] == "High")
  25.                 {
  26.                     int index = int.Parse(command[1]);
  27.  
  28.                     if (index >= 81 && index <= 125)
  29.                     {
  30.                         if (water >= index)
  31.                         {
  32.                             finalFire.Add(index);
  33.                             water -= index;
  34.                         }
  35.                        
  36.                     }
  37.                 }
  38.                 if (command[0] == "Medium")
  39.                 {
  40.                     int index = int.Parse(command[1]);
  41.  
  42.                     if (index >= 51 && index <= 80)
  43.                     {
  44.                         if (water >= index)
  45.                         {
  46.                             finalFire.Add(index);
  47.                             water -= index;
  48.                         }
  49.  
  50.                     }
  51.                 }
  52.                 if (command[0] == "Low")
  53.                 {
  54.                     int index = int.Parse(command[1]);
  55.  
  56.                     if (index >= 1 && index <= 50)
  57.                     {
  58.                         if (water >= index)
  59.                         {
  60.                             finalFire.Add(index);
  61.                             water -= index;
  62.                         }
  63.  
  64.                     }
  65.                 }
  66.             }
  67.  
  68.             Console.WriteLine("Cells:");
  69.             for (int i = 0; i < finalFire.Count; i++)
  70.             {
  71.                 Console.WriteLine($" - {finalFire[i]}");
  72.             }
  73.  
  74.             Console.WriteLine($"Effort: {finalFire.Sum() * 0.25:f2}");
  75.             Console.WriteLine($"Total Fire: {finalFire.Sum()}");
  76.         }
  77.  
  78.     }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement