Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Threading;
- namespace ConsoleApp1
- {
- class Exam
- {
- 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());
- double totalFood = days * players * food;
- double totalWater = days * players * water;
- 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;
- totalWater -= totalWater * 0.30;
- }
- if (i % 3 == 0)
- {
- totalFood -= totalFood / players;
- energy += energy * 0.10;
- }
- }
- if (energy <= 0)
- {
- Console.WriteLine($"You will run out of energy. You will be left with {totalFood:F2} food and {totalWater:F2} water.");
- }
- else
- {
- Console.WriteLine($"You are ready for the quest. You will be left with - {energy:F2} energy!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement