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