Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace DrumSet
- {
- class Program
- {
- static void Main(string[] args)
- {
- double savings = double.Parse(Console.ReadLine());
- List<int> drumSet = Console.ReadLine().Split().Select(int.Parse).ToList();
- List<int> currentSet = new List <int> (drumSet);
- string hitPower = Console.ReadLine();
- while (hitPower != "Hit it again, Gabsy!")
- {
- int hit = int.Parse(hitPower);
- for (int i = 0; i < currentSet.Count; i++)
- {
- currentSet[i] -= hit;
- if (currentSet[i] <= 0)
- {
- if (drumSet[i] * 3 <= savings)
- {
- currentSet[i] = drumSet[i];
- savings -= drumSet[i] * 3;
- }
- else
- {
- currentSet.RemoveAt(i);
- drumSet.RemoveAt(i);
- i--;
- }
- }
- }
- hitPower = Console.ReadLine();
- }
- Console.WriteLine(string.Join(" ", currentSet));
- Console.WriteLine($"Gabsy has {savings:f2}lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement