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