Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _01.TheHuntingGames
- {
- class Program
- {
- static void Main(string[] args)
- {
- int days = int.Parse(Console.ReadLine());
- int players = int.Parse(Console.ReadLine());
- double groupEnergy = double.Parse(Console.ReadLine());
- double waterPerDay = double.Parse(Console.ReadLine());
- double foodPerDay = double.Parse(Console.ReadLine());
- double totalWater = waterPerDay * players*days;
- double totalFood = foodPerDay * players*days;
- for (int i = 1; i <= days; i++)
- {
- double energyLoss = double.Parse(Console.ReadLine());
- if (groupEnergy <= 0)
- {
- return;
- }
- if (groupEnergy - energyLoss <= 0)
- {
- Console.WriteLine($"You will run out of energy. You will be left with {totalFood:f2} food and {totalWater:f2} water.");
- return;
- }
- else
- {
- groupEnergy -= energyLoss;
- if (i % 2 == 0)
- {
- groupEnergy *= 1.05;
- totalWater *= 0.7;
- }
- if (i % 3 == 0)
- {
- totalFood -= totalFood / players;
- groupEnergy *= 1.1;
- }
- }
- }
- Console.WriteLine($"You are ready for the quest. You will be left with - {groupEnergy:f2} energy!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment